loading...

Android interview: ANR

mauriciomunoz profile image Miguel Munoz ・1 min read

In the last days, my company gives me the task to do some short and simple interviews to applicants for the Android position.

One of the questions is about ANR. This question is one of the main ways to know if a developer knows about Android and sometimes is one of the questions in the top companies.

But, what is an ANR?

An ANR or Application Not Responding, is a simple error caused by the block of the UI Thread.

If the UI Thread is blocked for 5 seconds or more, we are going to get this issue and a Dialog will be showed asking if we want to wait or close the app.

This happens because maybe we have a long-performance task and Android can't draw in the UI Thread or can't receive any event from the user.

The cause of this could be a lot of things, but if you understand what is an ANR, you will be able to find the issue that is causing it. It could be a long task trying to do download something or maybe a large image trying to get showed.

If any of my post have mistakes, I am open to any feedback. Sometimes I could do bad explanation, so any comment is welcome. Together we can create a better guide to study and learn.

Discussion

pic
Editor guide