[英]How to create File from folder in android assets?
I want to list all files in folder which is in assets. 我想列出资产中文件夹中的所有文件。 But
new File("/android_asset/instagram").exists()
always returns false. 但是
new File("/android_asset/instagram").exists()
始终返回false。
File instagram = new File("/android_asset/instagram")
for (File lookUpFile : instagram.listFiles()) {
String filterName = FileUtils.removeExtension(lookUpFile.getName());
filterName = Strings.capitalizeAndCopy(filterName);
GPUImageLookupFilter lookupFilter = new GPUImageLookupFilter();
lookupFilter.setBitmap(BitmapFactory.decodeFile(lookUpFile.getAbsolutePath()));
filters.addFilter(filterName, lookupFilter);
}
Try to access the file using asset manager. 尝试使用资产管理器访问文件。 Try to get the list of files and make sure its working.
尝试获取文件列表,并确保其正常工作。
AssetManager assetManager = getAssets();
String[] files = assetManager.list("");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.