Android的:如何找到资产的文件夹的绝对路径?文件夹、资产、绝对路径、Android

2023-09-04 23:52:16 作者:紫·蝶·梦

我需要让我的应用程序资产的文件夹的绝对路径,我想提供内部使用的网络服务器中的文件,它需要绝对路径。这可能吗?

我会认为有可能是这样的:

 字符串ROOTDIR = getAssets()getRootDirectory()。
 

但事实并非如此。

任何帮助AP preciated,欢呼声。

解决方案   

这可能吗?

没有。没有在[你]的应用程序资产的文件夹的绝对路径。资产被存储在APK文件

手机乐视缓存的视频在哪个文件夹呢 怎么找不到呢

在选择的情况下,如提供给的WebView ,您可以用网址的特殊文件:/// android_asset 基本URL引用的文件在你的资产。

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.

解决方案

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.