What is an ANR? What are some measures you can take to avoid ANR?

Answer

ANR stands for ‘Application Not Responding’. This dialogue is displayed if the main thread in the application has been unresponsive for a long time and in the following conditions:

  • When there is no response to an input event after 5 seconds.
  • When a broadcast receiver is not done executing within 10 seconds.

 Following measures can be taken to avoid ANR:

  • To avoid ANR, an app should perform a lengthy database or networking operations in separate threads.
  • One technique is to create a child thread to prevent the Android system from concluding a code that has been unresponsive for a long period of time. Most of the actual workings of the codes can be placed within the child thread to ensure that the main thread runs with minimal unresponsive time.
  • For background task-intensive apps, you can alleviate pressure from the UI thread by using the IntentService.

All android-5.0-lollipop Questions

Ask your interview questions on android-5-0-lollipop

Write Your comment or Questions if you want the answers on android-5-0-lollipop from android-5-0-lollipop Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---