Android: How to find the absolute path of the assets folder?

Brendan Maguire picture Brendan Maguire · Feb 17, 2011 · Viewed 32.6k times · Source

I need to get the absolute path of the assets folder in my app as I want to serve the files within using a webserver and it needs the absolute path. Is this possible?

I would have thought there might be something like this:

String rootDir = getAssets().getRootDirectory();

but there's not.

Any help appreciated, cheers.

Answer

CommonsWare picture CommonsWare · Feb 17, 2011

Is this possible?

No. There is no "absolute path of the assets folder in [your] app". Assets are stored in the APK file.

In select cases, such as URLs supplied to a WebView, you can use the special file:///android_asset base URL to reference files in your assets.