我把图像放在 assets folder 中,然后想显示它们。在 logcat 中也没有显示错误,但是就是显示不出图像。为什么呢?
AssetManager mngr = mContext.getResources().getAssets();
is = mngr.open("test3.png");
bitmap = BitmapFactory.decodeStream(is);
Uri uriSavedImage=Uri.fromFile(pictures_directory);
((ImageView) view.findViewById(R.id.imageView1)).setImageBitmap(bitmap);
InputStream bitmap=null;
try {
bitmap=getAssets().open("test3.png");
Bitmap bit=BitmapFactory.decodeStream(bitmap);
img.setImageBitmap(bit);
} catch (IOException e) {
e.printStackTrace();
} finally {
if(bitmap!=null)
bitmap.close();
}
确定下图片的名字,路径等是否正确