Created
January 16, 2018 07:45
-
-
Save smyykb/bc8cb47f7cdd7e1050a2efe5edbc3d6a to your computer and use it in GitHub Desktop.
ANR vs Crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ANR (A pplication N ot R esponding )is due to handling long running task in Main Thread(UI thread).If the main thread is stopped for more than 5 sec you get ANR. | |
Crash are due to exception and error like Nullpoint,classNotfound, typecast ,parse error etc. ANR also causes crash of application. | |
ANR and Crash Examples: | |
ANR: | |
// this will produce an ANR on your app | |
int i = 0; | |
while(true) { | |
i++; | |
} | |
Crash: | |
// this will crash your app : will produce java.lang.ArithmeticException | |
int value = 5, i = 0; | |
int result = value / i; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment