java - Where should i declare the button of different layout? -


i've made calculator apps , i'm trying create page showing information. enter image description here 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.

http://developer.android.com/reference/android/app/activity.html#startactivity(android.content.intent)


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -