所以我对这个应用程序的制作都很陌生。
我尝试使用该命令到达文件
InputStream inputStream = openFileInput("files.txt");
它给了我错误"无法解决方法openFileInput(java.lang.String)
"。我的资源或资源中没有保存文件,它保存在我保存的任何地方当你在应用程序中创建它时。
功能
private void readFiles() throws IOException
{
cards.removeAll(cards);
InputStream inputStream = openFileInput("files.txt");
if(inputStream != null){
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
int size = Integer.parseInt(bufferedReader.readLine());
for(int i = 0; i < size; i++){
card tmp = new card();
tmp.setAlias(bufferedReader.readLine());
tmp.setIconID(Integer.parseInt(bufferedReader.readLine()));
tmp.setId(bufferedReader.readLine());
tmp.setRemaining(Integer.parseInt(bufferedReader.readLine()));
tmp.setDescription(bufferedReader.readLine());
tmp.setPeriodStartDate(bufferedReader.readLine());
tmp.setPeriodEndDate(bufferedReader.readLine());
tmp.setPeriodRemaining(Integer.parseInt(bufferedReader.readLine()));
tmp.setWaitingPeriods(Integer.parseInt(bufferedReader.readLine()));
tmp.setUnFetched(Integer.parseInt(bufferedReader.readLine()));
tmp.setNameDescription(bufferedReader.readLine());
tmp.setCardExpiryDate(bufferedReader.readLine());
tmp.setCardStatus(bufferedReader.readLine());
tmp.setDaysUntilCardExpiry(bufferedReader.readLine());
cards.add(tmp);
}
inputStream.close();
}
}