how to display external image in android?

前端 未结 2 1796
我在风中等你
我在风中等你 2021-01-03 10:50

I want to display external image like:

\"http://abc.com/image.jpg\"

in my android phone application.

can any one guide me how to achieve this?

2条回答
  •  时光说笑
    2021-01-03 11:11

    Just another approach to download the image from a url

    try {
      Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://abc.com/image.jpg").getContent());
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    

提交回复
热议问题