1.

What is ANR in Android? What are the measures you can take to avoid ANR?

Answer»

ANR(Application is Not Responding) is a dialog box that appears when the application is not responding. This ANR dialogue is displayed whenever the MAIN thread within an application has been unresponsive for a long time under the following conditions:

  • When there is no response to an input event even after 5 seconds.
  • When a broadcast receiver has not completed its execution within 10 seconds.

Following measures can be taken to avoid ANR:

  • An application should PERFORM lengthy database or NETWORKING OPERATIONS in separate threads to avoid ANR.
  • For BACKGROUND task-intensive applications, you can lessen pressure from the UI thread by using the IntentService.


Discussion

No Comment Found