Android的:如何找到资产的文件夹的绝对路径? [英] Android: How to find the absolute path of the assets folder?

查看:512
本文介绍了Android的:如何找到资产的文件夹的绝对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

 字符串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.

这篇关于Android的:如何找到资产的文件夹的绝对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆