简体   繁体   中英

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.

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("");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM