0

currently i am using an activity which does asyntask to retrive a list of data from a remote database.

After retrieving under the onPostExecute, i used the method to display out the information gathered from the remote database. Is this the correct way for threading? Previosuly i used a handler in the onPostexecute so that i can intersect the ui thread for displaying information

ericlee
  • 2,703
  • 11
  • 43
  • 68

2 Answers2

2

There's lots of ways to achieve multithreading in Android. If you need to perform some background operation then update the UI once this is complete, AsyncTasks are definitely the way to go. Keep in mind there is a thread limit. Look at this SO question for more information on thread limits.

Community
  • 1
  • 1
Jason Robinson
  • 31,005
  • 19
  • 77
  • 131
2

AsyncTask is efficient implementation of Haldler approach . so whenever multithreading needs to interact with UI thread use AsyncTask else follow standard java threading guidelines.

Shailendra Singh Rajawat
  • 8,172
  • 3
  • 35
  • 40