0

I want to know about ANR dialog in android applications and when it will happen and how to remove that. Please help me.

Cyril N.
  • 38,875
  • 36
  • 142
  • 243
Midhun VP
  • 629
  • 1
  • 10
  • 18
  • possible duplicate of [Handle ANR(Application not responding) dialog (Android)](http://stackoverflow.com/questions/4385323/handle-anrapplication-not-responding-dialog-android) – Nanne May 09 '12 at 12:12

2 Answers2

4

ANR - application not responding.

This dialog appears when the main thread of the application is blocked for too long, for example, when you sleep on this thread, or performing a long connection.

Avoiding it is done by moving the heavy operations to other threads. There's a great article regarding the ways to implement that - Painless Threading.

MByD
  • 135,866
  • 28
  • 264
  • 277
  • 1
    The article seems to have been moved to: http://android-developers.blogspot.com/2009/05/painless-threading.html – ef2011 Oct 15 '12 at 02:10
2

It will happen when you spend too much time on the main application thread. To avoid ANR errors, ensure any long-running work occurs on a background thread.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491