Reputation: 11
For example, this would be the path to a file on the external memory...
String path = Environment.getExternalStorageDirectory().toString()+"/myApp/face.jpg";
But is there also such a path to the Asset folder?
Cheers!
P.S.
"file:///android_asset/1.png"
Gives a file not found.
Upvotes: 1
Views: 5281
Reputation: 11027
The path to an asset is
file:///android_asset/[path_under_the_asset_folder]/your_file.ext
If you are getting a FileNotFoundException
, your [path_under_the_asset_folder]
is likely to be wrong.
Upvotes: 2
Reputation: 13710
In case you just need the path for accessibility-reasons you can use
AssetFileDescriptor descriptor = getAssets().openFd("file.txt");
FileReader reader = new FileReader(descriptor.getFileDescriptor());
Upvotes: 3