What is ANR ?
ANR(Application Not Responding) will occurs when You are going to execute long responsive work in the UI thread. UI thread is busy in doing long responsive work instead of giving response back to the client.
How to avoid ANR ?
To avoid ANR we should have to take separate thread of execution for time taking work. Number of built in functionality in android that provide this type of functionality like HANDLER, ASYNCTASK, INTENTSERVICE.
Android allows the system to protect the application that are not responsive for a period of time by displaying a status called as ANR(Application Not Responding).