August 15, 2014
I have created an application that loads the records using AsyncTask when an activity starts, however, the UI thread was making multiple threads running the same AsyncTask. The end result, a single record was shown multiple times in my UI. I tried to manually handle this scenario by creating flags and locking the objects, the only difference was, they are running in synchronize way and not in a parallel way.
Solution: I’ve created a class level instance of the AsyncTask and loaded it in onCreate method. So simple right? I read the documentation and life cycle of the Activity and the onCreate was loaded only once of its life cycle, don’t know why this is happening.
For the time being, this would do! 😀