Interviewer And Interviewee Guide

Sr. Android Developer Interview Question:

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

Submitted by: Muhammad
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.
Submitted by: Muhammad

Read Online Sr. Android Developer Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.