• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why handlers/AsyncTask are used?

 
gauravkv gupta
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Android technology, and after going through various post and blogs i understand the "What is handler/AsyncTask and how it is used" but i could not understand the fact that what we lose if we omit the Handlers and AsyncTasks from Android. So, i want to know "Why handlers are used and what problem handlers solve".

Please spare your valueable time and help me out in this.

Thanks in appreciation.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot perform long running tasks on the UI thread on Android. Doing so will make the OS want to kill your app quickly. The OS usually waits for ~X seconds before waiting for your UI thread to return. To avoid being zapped by android, you can use a AsyncTask / Service to perform long running operations.

Here is a great video that explains async operations

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic