button - android opening a new activity and return -
i have simple android app , has main page button leads sec page , sec page has 2 buttons: button_1 , button_2. , problem when click button_1 open new activity , homecoming , click button_2 app freezes few seconds , goes main page.
i think reason of problem when click button_1 open new activity have finish activity in someway before homecoming don't know how?
i using simple code open new activity using button:
button enterbtn = (button)findviewbyid(r.id.button1); enterbtn.setonclicklistener(new onclicklistener(){ @override public void onclick(view v) { intent in = new intent(secondpage.this, newpage.class); startactivity(in); } });
finsh activity using onpause method 1 time exit/go method execute finsh() method kills activity. 2 kid activities , solve freezing error.
@override protected void onpause() { // todo auto-generated method stub super.onpause(); finish(); }
android button android-activity
No comments:
Post a Comment