Greeting to all My application is almost Completed.But I am facing a problem that my application takes too much time to load image.
Asked
Active
Viewed 231 times
0
-
are you downloading the image from url? – Andy Developer Sep 14 '17 at 13:42
-
yes sir. i am downloading the images through url from firebase – Hussain Sep 14 '17 at 13:43
-
Can we see some code... Also, are you downloading the images on the UI thread? If so, don't and use a third party library or using AsyncTask – cincy_anddeveloper Sep 14 '17 at 13:44
-
Try Glide or Picasso library this will help you out. – Andy Developer Sep 14 '17 at 13:44
-
sir i am using picaso – Hussain Sep 14 '17 at 13:45
-
if you are using large images its going to take time to download, then resize it correctly – tyczj Sep 14 '17 at 13:47
-
can you tell me correct size. yes i am sending full size image and downloading full size image too . – Hussain Sep 14 '17 at 13:48
-
You problem is that you are loading full size images that may be larger than the View their being displayed in. It can quite a bit of time to downloaded, @ManzoorHussain decoded and displayed the images, based on network conditions on both sized and the devices specs. The size is based on the ImageViews width, we cannot give you the correct values, it's something you need to test manually to find the correct trade off of resolution and image size, based on acceptable display time and memory. – cincy_anddeveloper Sep 14 '17 at 13:55
-
@ManzoorHussain General advice for StackOverflow: you should provide relevant snippets of code, layouts, etc. Have a look at [how-to-ask](https://stackoverflow.com/help/how-to-ask). Also, have a detailed look at [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Xavier Rubio Jansana Sep 14 '17 at 13:56
-
@ManzoorHussain If you are using Picasso then downgrade the resolution of image – J Ramesh Sep 14 '17 at 13:57
-
To solve network latency problem, aside from providing an image with the right size, you can use a placeholder while loading: https://stackoverflow.com/questions/22143157/android-picasso-placeholder-and-error-image-styling#22786818 – Xavier Rubio Jansana Sep 14 '17 at 13:57
-
1@ManzoorHussain like that Picasso.with(context).load(business.getPhoto()).placeholder(R.drawable.default_business).resize(300, 300).centerCrop().into(imageView); – J Ramesh Sep 14 '17 at 13:58
-
Take a read here https://developer.android.com/topic/performance/graphics/load-bitmap.html – tyczj Sep 14 '17 at 14:05
-
@JRamesh thank you sir. its works really amazing just solved the problem now loaded all images :) – Hussain Sep 14 '17 at 14:07