What i am looking for is to find a way to manage a number of threads inside the Asyntask.
I need to sync my local database with server updates. This might be large data that can be retrieved using paging.
Can anybody tell me what is preferred way to manage generating threads in loop inside the asyntask so that it could display Progress Dialog until all of the thread completed.
I am little worried about the local database object & its synchronization during execution of different threads in order to download data from server & save/update into local database.
Note: I cant download all data from server in a single server call.
Thanks in advance.
If it's long running operation you should use IntentService instead of AsyncTask. IntentService is UI independent so you can run it in background. To update UI you can send broadcast intent. I use IntentService for DB sync. I get data from server, while parsing I create batch updates and then update local DB with one batch update.
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