-
Book Overview & Buying
-
Table Of Contents
Android Programming for Beginners - Fourth Edition
By :
When building apps with Java or any language that compiles to Java bytecode (like Kotlin), whether for Android or another platform, the most common cause of a program crash is a NullPointerException.
Of course, all programs will have bugs to squash and code with syntax errors to fix before compiling is possible. Still, the NullPointerException was particularly nightmarish for app developers because it occurs while the app is in use, often by end users.
Nothing will get your game or app bad reviews on the Google Play marketplace faster than an unexplained crash. To make matters worse, a NullPointerException could occur at different times depending on how the user interacts with the app, and not at consistent, easily traceable points.
Remember, Kotlin compiles to Java bytecode and runs on the Java Virtual Machine and therefore, can suffer from the same problems as Java code. In fact, the null reference is a problem common to most programming languages. It...