Shubham AgaRwal
Shubham AgaRwal

Reputation: 4823

Using picasso to load image ICONS and displaying it

I'm loading icon of the navigation view using image loading from URL. I am currently following this tutorial. There are certain problems that needs to get fixed in order to load an icon from URL.

I have tried adding three images one by one:

36 X36 px , 48 X 48 px, 72 X 72 px

Do we still need three different images, to support multiple screens?

In all three cases I could not find the difference. All the images look alike to each other in Moto E2 device. What will be the effect if all the devices fetch same image from server?

The problem is what size of icon should be use to cover a large range of devices that is small, medium, large. Or do we have to pass density of the server so that it can give us required image?

Also, Since the image is loaded asynchronously. Thus icons are not visible as they are loaded by Picasso after some time.

Upvotes: 0

Views: 422

Answers (1)

Sofiane Hassaini
Sofiane Hassaini

Reputation: 315

Maybe before load icons, check the current device's screen, if it's a large screen, then put the URL of the large icon in order to load and display the biggest icon

You can check device's screen using this code

if(getResources().getConfiguration().screenWidthDp >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
     //Load large icon
}

Upvotes: 1

Related Questions