I need to get Bitmap and sound from assets. I try to do like this:
BitmapFactory.decodeFile("file:///android_asset/Files/Numbers/l1.png");
And like this:
getBitmapFromAsset("Files/Numbers/l1.png");
private Bitmap getBitmapFromAsset(String strName) {
AssetManager assetManager = getAssets();
InputStream istr = null;
try {
istr = assetManager.open(strName);
} catch (IOException e) {
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(istr);
return bitmap;
}
But I get just free space, not image.
How to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…