读取Assets文件夹中的文件

来源:互联网 发布:c语言判断是否为质数 编辑:程序博客网 时间:2024/05/17 09:28

1.读取assets资源文件夹中指定文件

        InputStream is = getResources().getAssets().open("emojis/emoji_000.png");        Bitmap bitmap = BitmapFactory.decodeStream(is);      imageView.setImageBitmap(bitmap);

2.遍历某一个文件夹中的文件名列表

   final AssetManager assetManager = getAssets();        try {            // for assets/emojis add only subfolder name            String[] filelistInSubfolder = assetManager.list("emojis");        } catch (IOException e) {            e.printStackTrace();        }
0 0