I am using bitmapfun project (gridview) in my application and while i was testing this i found a problem. The steps to reproduce this problem are the following:
In the logcat i see that all images are being canceled in imageWorker's cancelPotentialWork() and they never start. My guess is that something is happening with the previous bitmapworkerTask(responsible for download) and there is a collision with the new task. In my app when the backbutton is pressed i clear all the caches. But this isn't the cause of the problem because i also tested the same scenario in the original bitmapfun and the problem also appeared! How can i fix this problem? I also changed the multi-threadingasynctask of the project into a single thread! Is there any possible way to clear all imageview references and cancel all running tasks?
Sorry for my english and for not giving more information about the nature of the bitmapfun project but it will extend my question very much!Ask me anything!
Edit: In order to reproduce the problem maybe is better to clear the cache every time you leave the activity with the menu option. Also it is not sure that the problem will appear if you follow steps 1-3 one time. Maybe you have to repeat them!
Edit2(Additional Help): When i start the activity without problem the logcat for the first image is the following:
04-24 02:31:56.400: D/ImageWorker(25625): doInBackground - starting work
04-24 02:31:56.400: D/ImageFetcher(25625): processBitmap - https://lh3.googleusercontent.com/--L0Km39l5J8/URquXHGcdNI/AAAAAAAAAbs/3ZrSJNrSomQ/s160-c/Antelope%252520Butte.jpg
04-24 02:31:56.400: D/ImageFetcher(25625): processBitmap, not found in http cache, downloading...
and when i start the activity with problem the logcat is this:
04-24 02:28:07.970: D/ImageWorker(24014): cancelPotentialWork - cancelled work for https://lh3.googleusercontent.com/--L0Km39l5J8/URquXHGcdNI/AAAAAAAAAbs/3ZrSJNrSomQ/s160-c/Antelope%252520Butte.jpg
Why in the second case when the cancelPotentialWork has been called the doInBackground never start? According to the sequence of code this is the next part which should be executed!Has anyone at least any idea where i should search for the error?
what happen to u is OK. Because the ImageFetcher load image when OnCreate(), but cancel by the network deactivate. it does not contain auto restart code. So if u want the loading auto restart, add code to detective the network's state change. I don't think it sensitive . Just let user to restart it by click sometiong like refresh button etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With