I have an application with tabs and every tab has HttpCLient that is triggered every time user clicks on the tab and a page is downloaded in a tabActivity thread. When user clicks on tab and then switches to another one, he must wait for a few seconds, so that the request will be sent to server and reply received. I want to make switching between the tabs asynchronous from the HttpClients. It did not work even when i put requests in threads and it even did not work when I introduced TabGroupActivity on every tab.
I have a separate class with all the requests to the server. SHould i extend this class with asyncTask? (This is actually the last thing i have been thinking about that could help)
EDIT:
On every tab onPause i am doing Thread.join() nad it seems that it is the action that slows down all the process of comming back to the same tab
to prevent UI from blocking, all potentially slow running operations (such as networking) should run in the background, e.g. via some way of concurrency such as Asynctask.
I think Asynctask is better choice (comparing with threading) because it encapsulate everything into a single class, and is native android. (e.g. you don’t need to use RunOnUIThread when using this class)
read this article for more information: http://www.vogella.de/articles/AndroidPerformance/article.html