Device File storage does not show lib, cache and data folders and does not allow me to create.

  • Thread starter Thread starter Android Central Question
  • Start date Start date
A

Android Central Question

I am trying to store data into a text file. Code snippet is as below -

String FILE_NAME = "co_ordinates.txt";
try {
FileOutputStream fos = Resource.getAppContext().openFileOutput(FILE_NAME, Context.MODE_PRIVATE);

for(int i=0; i< mDB.size(); i++) {
Pose2D pose =mDB.get(i);
Float X = pose.getX();
fos.write(X.toString().getBytes() );
}
fos.close();
} catch (Exception e) {
ToastUtil.showToast(Resource.getAppContext(),"File Write Error!");
e.printStackTrace();

Code is executing but I cant find the file anywhere. When I try to see it under my package in device file Explorer it says "run-as: Package 'com.example.myPackage' has corrupt installation"
 
I moved this to the Software Development forum for more specific traffic.
 
The file is being written to "no folder", since you don't specify one. At best, it's /sdcard/co_ordinates.txt (or whatever the particular phone calls its internal sd card). Try specifying a folder, starting from /
 

Members online

Forum statistics

Threads
955,235
Messages
6,964,157
Members
3,163,232
Latest member
Chloe7788