4

I was just facing ANR(Activity Not Responding) problem. I resolved thought but that ANR suddenly triggers a question in my mind.....

When ANR Occurs ?

    Reason: When your activity allocates lot of memory in background or UI is 
blocked more than 5 seconds. 

Who displays Alert Dialog ?

    Our activity is a main thread and Main thread can update/manipulate any UI 
elements. Showing Dialog is kind of change in UI.

My question is

Who is showing the ANR Alert Dialog?

Can anyone explain me ?

Now my question is if main thread is blocked as ANR error tells us, than how come OS can display ANR Alert dialog box on top of our Activity?

nobalG
  • 4,544
  • 3
  • 34
  • 72
Hardik Trivedi
  • 5,677
  • 5
  • 31
  • 51

1 Answers1

4

It's not your unresponsive app that's displaying the ANR dialog. It's a system error dialog displayed by ActivityManagerService.

laalto
  • 150,114
  • 66
  • 286
  • 303