tj walker
tj walker

Reputation: 1343

ANR in activity for broadcast of Intents

I keep getting this error. Can anyone tell me what it means or how i fix it? Thanks

07-03 08:27:13.615: ERROR/ActivityManager(61): ANR in com.fttech.books

07-03 08:27:13.615: ERROR/ActivityManager(61): Reason: Broadcast of Intent { act=android.intent.action.TIME_TICK flg=0x40000004 (has extras) }

Upvotes: 11

Views: 26844

Answers (2)

starnetdev
starnetdev

Reputation: 978

Flo is totally right in its explanation of the issue.
In my case setting some Breakpoints in the onReceive() method and trying to start an Activity with an Intent caused the debug to be broken. I can perfectly reproduce the issue.

The solution is to disable all breakpoints and set them at the start of the new Activity, or if you need to debug onReceive(), log what happens there with Log() function.
There could be also other errors in the code that may break the debug.

Upvotes: 1

Flo
Flo

Reputation: 27455

ANR stands for "Application not responding". This message means that your application isn't responsive to the user anymore. Normally this exception is thrown if the UI thread is blocked by an operation that takes more than 5 seconds. Here are some information on this topic.

Android applications normally run entirely on a single (i.e. main) thread. This means that anything your application is doing in the main thread that takes a long time to complete can trigger the ANR dialog because your application is not giving itself a chance to handle the input event or Intent broadcast.

So check your code if you're doing any long-running operations on the UI thread.

Upvotes: 19

Related Questions