Load Image in ImageView from URL stored in JSONString in Android

前端 未结 5 728
梦如初夏
梦如初夏 2021-01-13 13:31

I have a JSON string, say a name and a Url . I need to extract name into the TextView and extract and display image in ImageView. Belo

5条回答
  •  耶瑟儿~
    2021-01-13 14:10

    You can use GSON library to parse the json into a plain Java Object and then use that object to fill in the TextView and ImageView. If you don't want to use external libraries you can use JSON classes like this:

    JSONObject object = new JSONObject("your strnig");
    JSONObject webimages = object.getJSONObject("WebImages");
    String imageName = webimages.getString("image_name")
    String imageUrl = webimages.getString("imageurl")
    

提交回复
热议问题