bad bitmap error when setting Uri

后端 未结 6 1836
暗喜
暗喜 2021-02-19 12:00

I would like to make an ImageView display an image on a website. So I create a new ImageView and execute imgView.setImageURI(uri);

When I launch the app the

6条回答
  •  無奈伤痛
    2021-02-19 12:42

    First, you should download the image and save it in your device(sdcard or memory). Then, get its file path, using Uri.parse(filePath) to convert path to uri finally, call ImageView's setImageURI(Uri) to fullfill. -- I use this way to achieve my purpose and there is a bug:if the image is to large(maybe exceed 1Mb or so, it may report outOfMemeroy Exception!!!)

提交回复
热议问题