Home > DeveloperSection > Interviews > What is a ANR ?What are the measures to avoid application ANR?

Posted on    June-08-2015 12:16 AM

 Android Android 
Ratings:
 1 Answer(s)
  651  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Points:4035
Posted on    June-08-2015 12:16 AM

ANR is short for Application Not Responding. Android systems shows this dialog, if application is performing too much of task on main thread and been unresponsive for a long period of time.
ANR in application is annoying to user. It can be caused due to various reasons. Below are some of the tips to avoid ANR

Perform all you long running network or database operation in separate thread
If you have too much of background tasks, then take it off the UI thread. You may use IntentService
Server not responding for longer period can be guilt for ANR. To avoid always define HTTP time out for your all your webs service calls.
Be watchful of infinite loops during your complex calculations

Don't want to miss updates? Please click the below button!

Follow MindStick