//保存
private void saveFile(String fileName, String content)
{
File pathFile = new File(getFilesDir(), fileName);
try
{
FileOutputStream fos = this.openFileOutput(fileName,Activity.MODE_PRIVATE);
fos.write(content.getBytes());
fos.flush();
fos.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
//读取
private int loadFile(String fileName)
{
int content = 6;
File pathFile = new File(getFilesDir(), fileName);
if (pathFile.exists())
{
try
{
FileInputStream fis = new FileInputStream(pathFile);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
String content = br.readLine();
br.close();
fis.close();
content = Integer.parseInt(content);
} catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
}
return content;
}