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

  • Thread starter Android Central Question
  • 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"
 

Rukbat

Retired Moderator
Feb 12, 2012
44,529
26
0
Visit site
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
942,996
Messages
6,916,805
Members
3,158,767
Latest member
dumpsterrentals37