Search code examples
androidpathdirectoryassets

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


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.


Solution

  • 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.