Android 是否将Imageview设置为在SD卡中显示图像?

Android 是否将Imageview设置为在SD卡中显示图像?,android,android-layout,android-imageview,android-image,Android,Android Layout,Android Imageview,Android Image,我有一个图像存储在我的手机SD卡。我想在图像视图中显示它。我知道文件的位置。关于活动的oncreate,有没有一种简单的方式来表达 ImageView img = (ImageView) findViewById(R.id.imageView1); String path = Environment.getExternalStorageDirectory().toString() "Images/image.jpg"; img.setsrc = path ; 如果有什么办法,

我有一个图像存储在我的手机SD卡。我想在图像视图中显示它。我知道文件的位置。关于活动的oncreate,有没有一种简单的方式来表达

ImageView img = (ImageView) findViewById(R.id.imageView1);    
String path = Environment.getExternalStorageDirectory().toString() "Images/image.jpg";     
img.setsrc = path ;
如果有什么办法,请告诉我。多谢各位

Bitmap bmp = BitmapFactory.decodeFile(pathName);
ImageView img;
img.setImageBitmap(bmp);

希望这能有所帮助。

我有一个片段可能会有所帮助:

File imageFile = new  File("/sdcard/example/image.jpg"); 
if(imageFile.exists()){
    ImageView imageView= (ImageView) findViewById(R.id.imageviewTest);
    imageView.setImageBitmap(BitmapFactory.decodeFile(imageFile.getAbsolutePath()));
}

:)

我无法加载图像大小为1.98 MB、相机图片大小为16M像素的位图。如果位图一直在创建并在ImageView上设置,我们是否需要调用位图上的循环?活动结束时,图像会丢失,无论如何,要使其永久化,还是我必须将路径字符串作为文本写入SD卡并每次读取?