java - Where should i declare the button of different layout? -
i've made calculator apps , i'm trying create page showing information. ok button coded setcontentview(originallayout.xml) return calculator layout.
where should put these codes declare ok button?
private button btnok;
btnok = (button)findviewbyid(r.id.btnok);
btnok.setonclicklistener(oklistener);
i tried put these code below did buttons @ main layout apps stopped after launch.
07-18 09:39:43.290: e/androidruntime(6984): java.lang.runtimeexception: unable start activity componentinfo{com.hychentsa.calculator/com.hychentsa.calculator.calculatoractivity}: java.lang.nullpointerexception
instead of using setcontentview() change screens, should have separate activities. then, in activity, can call finish() on button click go main activity.
Comments
Post a Comment