Skip to content Skip to sidebar Skip to footer

How To Get Path Of File In Raw Folder Android

I need the String Address of the raw folder directory this is my code but it ends with crash private String zipPath = String.valueOf(getResources().openRawResource(R.raw.zipfile));

Solution 1:

Resources are files on your development machine. They are not files on the device. There is no path to your raw resource.

getResources().openRawResource(R.raw.zipfile) is fine, to give you an InputStream. Use that to read in your resource contents.

And, in general, calling String.valueOf() or toString() on objects is for getting some developer-readable string. The string representation of an InputStream is not going to be a filesystem path.

Post a Comment for "How To Get Path Of File In Raw Folder Android"