Skip to content Skip to sidebar Skip to footer

How To Display Image In A Listview From Json Response In Android

Hi in the below code am displaying data from json response using retrofit library. using recylerview am displaying title,id,albumid as well as image.all are displaying except image

Solution 1:

Using Picasso:

Add this line to your app-level build.gradle file.

implementation 'com.squareup.picasso:picasso:2.71828'

And you can simply set image to ImageView by:

Picasso.get().load(item.get(position).getThumbnailUrl()).into(holder.imageForText);

Using Glide:

Add these lines to your app-level build.gradle file.

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

And you can simply set image to ImageView by:

GlideApp.with(this).load(item.get(position).getThumbnailUrl()).into(holder.imageForText);

Solution 2:

You can use library for that, like Picasso

implementation 'com.squareup.picasso:picasso:2.71828'

To use it :

Picasso.get().load("IMG URL").into(YOURIMAGEVIEW);

Solution 3:

You have to use such type of libaray like picasso or universal image loader etc for load image on Your ImageView like in this I am using picaso

implementation 'com.squareup.picasso:picasso:2.71828'

Picasso.get().load(item.get(position).getThumbnailUrl()).into(imageForText);

Post a Comment for "How To Display Image In A Listview From Json Response In Android"