Load images for different screen sizes from the server using picasso?
Asked Answered
C

2

0

Hello i am making an android app in which i am getting images from the server and for that i am using picasso library now my question is that as there are different densities of screens with different sizes including (ldpi, mdpi, hdpi, xhdpi )required for different devices now i want to know in background does picasso itself do something so that if i will open an high density pic on an small screen size mobile then it will not get blurred or something or hang my phone or anyway so that it can dynamically adjust the pic for respective devices. Can i use ninepatch images for resolving my query.

Update- i have read answers that picasso itself handle all these densities problems but in my case what am i doing wrong because of what my recyclerview is hanging ??

Carbonado answered 16/10, 2015 at 20:32 Comment(0)
D
1

Picasso won't know which image to download but check out Picasso.fit() which per the doc will Attempt to resize the image to fit exactly into the target {@link ImageView}'s bounds

Despond answered 16/10, 2015 at 20:36 Comment(1)
i used fit() but still my recyclerview is hanging can you please ell me what other things i can do ??Carbonado
S
1

ninepatch used for system elements images rather than pictures. You have not specified the image is part of the interface or content.

You can get the density of the screen and the resolution of software and stretch / compress the image. (I would in your place was not afraid of distortion and memory problems in the low devices) So what can you do multiple sets of graphics on the server, if so worried.

But most of all, you really will approach the solution of this response.

But it's weird, to be honest. We need more information. I normally use drawable-XXX, ninepatch for buttons (backgound panels...), and stretch / compress on RapidDecoder for content.

Stob answered 16/10, 2015 at 20:42 Comment(4)
i am fetching thumbnails of the restaurants and they are hanging my recyclerview i am using resize with centrecrop in picasso can you tell me what is the bug here ??Carbonado
I think everything is fine.Stob
i have read answers that picasso itself handle all these densities problems but in my case what am i doing wrong because of what my recyclerview is hanging ??Carbonado
I did not notice your update. According to it, I can not tell. Sorry.Stob

© 2022 - 2024 — McMap. All rights reserved.