Assets資料夾
阿新 • • 發佈:2018-12-15
try {
Context ctxDealFile = this.createPackageContext("com.example.dynamicaction",
Context.CONTEXT_IGNORE_SECURITY);
Context context=ctxDealFile;
String uiFileName = "dexdir";
// 只能列出assets/dexdir 中的子目錄和子檔案(不列出子子目錄和子子檔案)
String str[] = context.getAssets().list(uiFileName);
for (int i = 0; i < str.length; i++) {
System.err.println("===> "+str[i]);
}
// 列出assets/ 中的所有子目錄和子檔案
String str222[] = context.getAssets().list("");
for (int i = 0; i < str222.length; i++) {
System.err.println("=222==> "+str222[i]);
}
} catch (Exception e) {
e.printStackTrace();
}