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:
- Open wifi -> launch app -> download images (It works fine).
- Close app (back button), deactivate wifi -> activate data network -> relaunch app (Still works fine).
- Before all the images were download, i close the app(back button) -> deactivate data network -> activate wifi. After this step when i relaunch the application the images doesn't download.
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?