In my application, when user presses Sync button (calls function onSynchronize()
), I need to do the following activities:
- form url for data synchronization based on user's preferences
- download url
- parse data received
- for each item found in data download picture (another url)
- update
ListView
with data downloaded and parsed
What is the best approach to split this activity between classes? Since steps 2-4 should be done in background (ASyncTask
), and the same steps 1-4 will be used in the service (for automatic synchronization).
Should I put step 5 in onPostExecute
of according ASyncTask
? Or, should I put there steps 3-5? What is the most logical and clear approach?