android从Assets中读取图片


/**
  * 从Assets中读取图片
  */
private Bitmap getImageFromAssetsFile(String fileName, Context context) {
    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();
    }

你可能感兴趣的:(android从Assets中读取图片)