java - Additional Intents -
before state question, new android studio , java. i've been learning go along , learning mistakes. go easy on me, newbie :p
so i've started project in android studio. on main activity have created 2 buttons - 'sign up' , 'sign in'
now have created , intent 'sign up' button go new activity (2nd activity)
but problem 'sign in' button. why when click 'sign in' button not respond , go straight new activity (3rd activity), have created onclicklistener?
i have click 'sign up' button goes sign activity , press 'back' , allows me click sign in button go sign in activity.
i hope makes sense.
i appreciated if got me on that. it's simple fix, said, newbie shoulder shrug
however, i'll tinker around , try work out
thanks in advance!
(let me know if want me post relevant code).
public class mainactivity extends actionbaractivity { private static button button_sbm; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); onclickbuttonlistener(); } public void onclickbuttonlistener(){ button_sbm = (button) findviewbyid(r.id.signupbut); button_sbm.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent("com.teamsix.fezzy.gosheesh.signupactivity"); startactivity(intent); button signinbut = (button) findviewbyid(r.id.signinbut); signinbut.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent ("com.teamsix.fezzy.gosheesh.signin"); startactivity(intent);
that because linking click listener sign in after click sign up, before that, button doesn't have click listener.
your code should this
public void onclickbuttonlistener(){ button_sbm = (button) findviewbyid(r.id.signupbut); button_sbm.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent("com.teamsix.fezzy.gosheesh.signupactivity"); startactivity(intent); } }); button signinbut = (button) findviewbyid(r.id.signinbut); signinbut.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent ("com.teamsix.fezzy.gosheesh.signin"); startactivity(intent); } });
Comments
Post a Comment