path:"/data/data/com.example.test/files/test.xml"
store:
try {
File file = new File(path);
if(!file.exists()){
file.createNewFile();
}
FileOutputStream os = context.openFileOutput(fileName,Context.MODE_PRIVATE);
os.write(txt.getBytes("UTF-8"));
os.close();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
read:
File file = new File(path);
try {
if(!file.exists()){
file.createNewFile();
}
InputStream input = new FileInputStream(file);
ArrayList<MyTrackPoints> list = MyXml.parserXml(input);
return list;
} catch (IOException e) {
e.printStackTrace();
return null;
}