0
嗨,我想在我的Android資產文件夾中的文件的路徑。如何以String的形式獲取資產文件路徑?
我如何獲得作爲字符串的路徑?
我嘗試:
String path = getClass().getClassLoader().getResource("file:///android_asset//psp.pdf").getPath();
我需要的路徑字符串。
嗨,我想在我的Android資產文件夾中的文件的路徑。如何以String的形式獲取資產文件路徑?
我如何獲得作爲字符串的路徑?
我嘗試:
String path = getClass().getClassLoader().getResource("file:///android_asset//psp.pdf").getPath();
我需要的路徑字符串。
訪問一個資產的唯一途徑是:
通過open()
上AssetManager
,在這種情況下,你的路徑是psp.pdf
通過在WebView
file:///android_asset/
,在這種情況下,你的路徑是file:///android_asset/psp.pdf
資產既不是fil上的文件系統,也不是你從ClassLoader
得到的東西。
可能的答案http://stackoverflow.com/questions/8474821/how-to-get-the-android-path-string-to-a-file-on-assets-folder。 tl; dr,這是不可能的。 –
http://stackoverflow.com/questions/4820816/how-to-get-uri-from-an-asset-file –
[如何獲取android路徑字符串到資產文件夾上的文件?](http ://stackoverflow.com/questions/8474821/how-to-get-the-android-path-string-to-a-file-on-assets-folder) –