How many times you have seen “application not responding” (ANR) when working with Android? If you are a Samsung Galaxy Ace II user, you may have experience that when the system is about to finish boosting an “application system is not responding” massage comes out from nowhere. At this time many just kill the process and wait for a response.
You may be a good code writer that wins all performance tests. But the worst thing you can expect for your app is an ANR. So, it is critical to design responsiveness into your app so that the system cannot display an ANR box to any user.
If an application blocks or the app takes too much time building more elaborate in-memory structure, or sometimes contemplating the next move, the system puts out an ANR to a user input. It is important to make sure computation is efficient. One way to address the issue is to not to perform the work on UI thread but to create a separate worker thread to do the most work. This keeps the user thread free to run the user interface and prevent the system putting out an ANR.