I'm doing my first Android app here and I'm trying to write an ArrayList<String> to a file, and read it back.
Here's my code to write the file:
(Class is called SaveFiles)
public static void writeList(Context c, ArrayList<String> list){
try{
FileOutputStream fos = c.openFileOutput("NAME", Context.MODE_PRIVATE);
ObjectOutputStream os = new ObjectOutputStream(fos);
os.writeObject(list);
os.close();
Log.v("MyApp","File has been written");
}catch(Exception ex){
ex.printStackTrace();
Log.v("MyApp","File didn't write");
}
}
I don't have code yet to read the file.
Code that calls this method:
//TempArrays.loadCustomTitles() loads a pre-created file that has entities
SaveFiles.writeList(getApplicationContext(), TempArrays.loadCustomTitles());
The log says the file's been created, but I can't find the file ANYWHERE on my phone, I literally looked in all places the file should be, so either it's hidden or, more precisely, isn't being created.
I declared
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
in my manifest.
Anyone know what's wrong with it?