Thursday, 15 April 2010

android - onclick Caused by: java.lang.NullPointerException -



android - onclick Caused by: java.lang.NullPointerException -

i'm new android development. encoutered issue when nail button on application. i'm not sure caused because worked flawlessly before did editing app, adding activity, removing software menu buttons on splash screen, other stuff. not much of had first activity problem exists. would've posted of code website refused allow me so

when nail button (readybutton) next error:

java.lang.runtimeexception: unable start activity componentinfo {com.unviewedchat/com.unviewedchat.secondactivity}: java.lang.nullpointerexception @ android.app.activitythread.performlaunchactivity(activitythread.java:2195) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2245) @ android.app.activitythread.access$800(activitythread.java:135) @ android.app.activitythread$h.handlemessage(activitythread.java:1196) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5017) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) @ dalvik.system.nativestart.main(native method) caused by: java.lang.nullpointerexception @ com.unviewedchat.secondactivity.oncreate(secondactivity.java:23) @ android.app.activity.performcreate(activity.java:5231) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) @ android.app.activitythread.performlaunchactivity(activitythread.java:2159)

             

button code (readybutton)

button1 = (button)findviewbyid(r.id.readybutton); button1.setonclicklistener(this); } button button1; private void readybuttonclick() { startactivity(new intent("unviewedchat.secondactivity")); } public void onclick(view v) { switch (v.getid()) { case r.id.readybutton: readybuttonclick(); break; } }

secondactivity row 22-23

button2 = (button)findviewbyid(r.id.help); button2.setonclicklistener(this); }

this code software menu buttons open help screen, effect button code firstactivity?

there no code on secondactivity i'm trying access, i'm trying go activity when hits button.

i attempted post of error report, told wasn't formatted correctly when was, either way added of it.

just change:

startactivity(new intent("unviewedchat.secondactivity"));

with this:

startactivity(new intent(this, secondactivity.class));

java android

No comments:

Post a Comment