It is inevitable for an Android novice to encounter a null pointer problem. For example, when debugging a program on the appearance of "I'm sorry!" ' XXX ' has stopped running! "This is a representation of a null pointer.
Why is there a null pointer?
The so-called null pointer exception is because the property or method is called with null (NULL).
Null means there is no such object, since there is no such object, then to invoke his properties and methods, it will report an exception.
<--is mainly for the following reasons:
1. Uninitialized variables are used (although declared)
2. Uninitialized objects are used (although declared)
3. Use a keyword or an existing class name variable object method or class names.
This exception is thrown when an application attempts to use null where the object is needed.
<--This situation includes:
Invokes an instance method of a null object.
A field that accesses or modifies a null object.
Use NULL as an array to get its length.
Use NULL as an array to access or modify its time slice.
Throws null as the Throwable value.
(The above points to understand, and then look at your code, will definitely find out)
Now that you know why you're wrong, you have to see where it went wrong. See Logcat
Look closely at Logcat and you will find a mistake. Like what
Warning: Problem parsing stream-java.lang.nullpointerexceptionjava.lang.nullpointerexception<span style= "color:# ff0000; " > at Com.semaphore.util.plist.PElementAdapter.get (pelementadapter.java:25) at Com.semaphore.util.plist.PList.get (plist.java:25) at Com.semaphore.util.plist.PElementAdapter.getPath ( pelementadapter.java:31) </span> at Com.semaphore.TinyLoader.findLibs (tinyloader.java:76) at Com.semaphore.TinyLoader.main (tinyloader.java:37) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) At Sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source) at Sun.reflect.DelegatingMethodAccessorImpl.invoke ( Unknown source) at Java.lang.reflect.Method.invoke (Unknown source) at Com.exe4j.runtime.LauncherEngine.launch ( Unknown source) at Com.exe4j.runtime.WinLauncher.main (Unknown source)
from the above 3rd, 4, 5 is easy to see the Pelementadapter.java in the 25, 31 lines, plist in the 25th line, etc. there are errors. Specific errors to find themselves.
Java.lang.NullPointerException NULL pointer problem