Android Development java.lang.RuntimeException:Unable to start activity componentinfo{xxx}: Java.lang.NullPoi
Error message string: Java.lang.RuntimeException:Unable to start activity Componentinfo{com.first/com.first.game}: Java.lang.NullPointerException
Generally in the activity OnCreate () method of Setcontentview (XXX) This error occurs, online access to a number of reasons, there are about four important possible reasons:
Reason one: XXX error, if it is r.layout.main then should be the Main.xml file label use error, the most common and the compiler will not prompt the error is android:name and Android:id both confused, Carefully check that the Main.xml labels are all correct
Reason two: the Requestwindowfeature () method is used after the Setcontentview (view) method, and under this error, the requestfeature must be used before Setcontentview, Only need to put the Requestwindowfeature () method before the Setcontentview (view) method can be resolved
Reason three: In addition to the OnCreate () method, and does not belong to any one method of the body directly to a control FindByID (r.id.xx) caused, need to be within a method and before the Setcontentview (view) method FindByID ( R.ID.XX) can be resolved
Reason four: The view is not instantiated prior to Setcontentview (view), only declared and directly setcontentview (view), carefully check whether the view Setcontentview (view) can be resolved before calling and instantiating within a method
Cause five: Because of a null pointer error exception, you should check if there is a value in something like Spinner or list.
Android Development java.lang.RuntimeException:Unable to start activity componentinfo{xxx}