What are exceptions in Android?
Oops, App crashed!
“Unfortunately your App has been stopped”- Being an Android coder you don’t want to see that message while running your app. Most obvious not even the coder but also all the users while running any of the App would expect the app to work faster and smoother. Users sometimes might be unhappy with the APP for any reasons like buttons\links are not working as they intended to be, Some APPs may take more battery consumption, and some may take large Mobile data etc.
The most common scenario nowadays when APP Stops\exits automatically? The user would either move out of the APP and if the problem still persists then might be they have (Uninstall) the APP.
Now the Question arises, what is ANR (APP NOT RESPONDING) in Android? Is it the exception or Error?
To be precise ANR is a condition, not exactly an “exception” or “error”. If we are running the process on UI thread takes a long time like around 5 seconds then in that case ANR dialog box will appear for user and would be prompting them to either wait or close the application.
We always keep our main thread as light as possible. To avoid ANR we can run our lengthy task in a separate thread instead of main thread
To learn Mobile Technology, ANDROID DEVELOPMENT, DELHI. Join CPD TECHNOLOGIES today.