Androidstudio根据图片路径获取本地图片的方法

  1. String path="//sdcard//DCIM//a31.jpg";
    File file = new File(path);
    
    if(file.exists()){
        Bitmap bm = BitmapFactory.decodeFile(path);
        pruductImg.setImageBitmap(bm);
    }
    
  2. private ImageView pruductImg;
    pruductImg.setImageURI(
    Uri.fromFile(newFile(CommonParameter.getMyproduct().getmImg()))
    );
    原文作者:阿孓
    原文地址: https://blog.csdn.net/qq_22079023/article/details/120922273
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞