1
我想試試oobjloader。 (免費波形3D格式加載器)我加載了第一個.obj,但沒有找到原始目錄。 (或只是沒有找到該文件)如何在android中獲取原始文件或原始目錄?
Uri url = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.cube1);
String filename = url.toString();
try {
Build builder = new Build();
Parse obj = new Parse(builder, filename);
} catch (java.io.FileNotFoundException e) {
System.out.println("trace FileNotFoundException loading file " + filename + ", e=" + e);
e.printStackTrace();
} catch (java.io.IOException e) {
System.out.println("trace IOException loading file " + filename + ", e=" + e);
e.printStackTrace();
}
如何獲得原始文件目錄url?
錯誤:
10-18 22:10:42.714 6136-6136/com.solar.asc.solar I/System.out﹕ trace FileNotFoundException loading file android.resource://com.solar.asc.solar/2131099648, e=java.io.FileNotFoundException: /android.resource:/com.solar.asc.solar/2131099648: open failed: ENOENT (No such file or directory)
10-18 22:10:42.714 6136-6136/com.solar.asc.solar W/System.err﹕ java.io.FileNotFoundException: /android.resource:/com.solar.asc.solar/2131099648: open failed: ENOENT (No such file or directory)
10-18 22:10:42.714 6136-6136/com.solar.asc.solar W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:416)
10-18 22:10:42.714 6136-6136/com.solar.asc.solar W/System.err﹕ at java.io.FileInputStream.<init>(FileInputStream.java:78)
我也試過其他格式,但沒有幫助。
"android.resource://" + getPackageName() + "/raw/cube1"
"android.resource://" + getPackageName() + "/raw/cube1.obj"
Thx all answare。
Thx,答案,但我不想要.obj內容。我想要資源原始文件網址或原始目錄網址。我會給文件的url外部庫。 (oobjloader)只是沒有找到該文件。 – Cipo
我想你會得到uri文件:/// android_res/raw/你可以試試這個。 –
dex
沒有幫助。但是,thx。也許我應該找資產。 – Cipo