I am trying to make an app which when first loads download all the data onto the application which includes XML of id,name,etc , profile infos, profile image etc. These things I load using a AysnTask which calls my XMLParser which makes the data structure and then on return to doinBackground(), it inserts onto the database with imagelink(profile image). Then onPostExecute(), it starts the gridview which has Imageview as the child, which takes the profile image to load using a ImageLoader example in this tutorial.
Image gets loaded in a class which implements Runnable in run() method, I displayed the image and save that to Sqlite using BLOB. I set a logic in the Runnable class that when last profile image is loaded, it inserts a flag in one of my table, which ensures that next time apps is opened it will get the values from the DB not from the Server.
The issue comes when user close the application some time after opening it however as I have been loading the images in a Runnable so they get broken.... the logic to set the flag does not finished.
How can I make this work?