Android 获取assets文件夹中的图片资源

来源:互联网 发布:淘宝代购可以退货吗 编辑:程序博客网 时间:2024/05/16 08:27
* 读取Assets文件夹中的图片资源  * @param context  * @param fileName 图片名称  * @return  */ public static Bitmap getImageFromAssetsFile(Context context, String fileName) {       Bitmap image = null;       AssetManager am = context.getResources().getAssets();       try {           InputStream is = am.open(fileName);           image = BitmapFactory.decodeStream(is);           is.close();       } catch (IOException e) {           e.printStackTrace();       }       return image;   }