I am using sax parser in android and i am displaying the content parsed into a custom list view which even contains an image.
The image is loading very slowly and thereby my list which contains 10 elements are displayed after few minutes and even if the list loads to scroll the image its taking time saying that My SAX parser app is not responding.
Is there any way to make the images to display fast and make the app respond properly on scrolling the list?
Thanks in advance.

Recommended Answers

All 12 Replies

You can use either AsyncTask or even better Loader (unlike AsyncTask Loader is not restarted on orientation change that does trigger multiple requests) to to manage downloading process and in same time to indicate to user that this is downloaded content and it will be displayed once finished

thanks peter budo..
does Async task concept is the same as using something like queue (actually i am not aware of that concept but i googled it and found a huge code Click Here for this image loading)??.
Is there any other way to do this task?

will a thread at the place of loading the image help in solving my problem?
I tried using a thread and a run() for loading image from the URL and set it to the image view.
It seemed to work for the first time and again when i go to the apps and restart the app its not getting loaded as it did the first time.

Thanks in advance

You should start reading more API documentation instead of trying to hack away solution from code you will find on internet as you are missing basic concepts. AsyncTask and Loader already acomodate threading, secondly while they are doing something you are able to show progress bar or any custom loading screen. Once data obtained you can on finish of either of them stop what ever notification you showed to user in mean time

i found this line which helped to get out of my problem.

 Bitmap.createScaledBitmap(myBitmap,100,100, true);

But i am not sure whether to use this or not.
can anyone say whether this statement safe to use?
thanks in advance.

the above one is working fine only for few times.

does your image has high mega pixels....?

they are about 480 *360

i tried some code to download the images using external storage concept and file cache.
It works fine in samsung mobile but it crashes in HTC.
What might be the reason?

Check exceptions and error log and post it back

how can i check logcat in mobile?

Connect your phone with IDE(IntelliJ or Eclipse) or use DDMS tool

the problem is solved.
i initialised the bitmaps which i am displaying during the process with null and used later.
This helped in solving the issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.