android根据图片路径显示图片

首先根据图片路径先创建一个文件path为图片路径;然后判断文件是否存在,如果存在,将图片显示出来。

File file = new File(path);

ImageView img = (ImageView) findViewById(R.id.img);

if(file.exists()){

       Bitmap bm = BitmapFactory.decodeFile(path);

       img.setImageBitmap(bm);

}

原文地址:https://www.cnblogs.com/kingsam/p/5644037.html