Reputation: 21
The file i want to open is located in the file:
/data/data/MY_PACKAGE/files/samplefile.txt
I have pulled the file from ddms and the desired content is in it
I just want to get the text file in order to parse it..
I tried the following:
File sdcard = Environment.getExternalStorageDirectory();
//Get the text file
File xmlFile = new File(sdcard,"samplefile.txt");
but no joy...
Thanks in advance!!
Upvotes: 1
Views: 586
Reputation: 22306
In order to open a file stored within your applications private directory you must use openFileInput(String fileName). This will return a FileInputStream that you can then work with.
Upvotes: 0
Reputation: 1006724
Use getFilesDir()
, not Environment.getExternalStorageDirectory()
, to get at the root of internal storage, where your file resides.
Upvotes: 1