Android code to fetch Image from server and display it in Imageview

后端 未结 4 1523
逝去的感伤
逝去的感伤 2020-12-22 08:11

Hi I know how to fetch an string from jsonobject, but my question is how to fetch an image from Rest api and display it. The image is stored as profile_image in jsonobject

4条回答
  •  眼角桃花
    2020-12-22 08:20

    If you want to use Picasso Image library for this, you can do it like this:

    if (object.has("profile_image") {
      Picasso.with(context).load(object.get("profile_image")).into(R.id.image_view);
    }
    

    Check out https://github.com/square/picasso for documentation.

提交回复
热议问题