以读取图片为例,读取assets下image文件夹中的某个图片
/**
* 从Assets/image中读取图片
* @param fileName 文件名
*/
public static Bitmap getImageFromAssetsFile(Context context, String fileName ) {
Bitmap image = null;
AssetManager am = context.getResources().getAssets();
try {
InputStream is = am.open("image/"+fileName+".png");
image = BitmapFactory.decodeStream(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
return image;
}