Android: Activity that close your antecessor -
i have 2 activities, "a" , "b", "a" opens "b". when user hits button on activity "b", don´t want see "a", want close "a". on "b" did this:
@override public void finish() { // todo auto-generated method stub intent intent = new intent(this, loginactivity.class).putextra(tag, tag).setflags(intent.flag_activity_clear_top); startactivity(intent); //super.finish(); }
and in activity "a", did this:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if(getintent().getextras() != null) if(getintent().getstringextra(homeactivity.tag) != "") finish(); }
it works perfectly, i´m getting exception:
e/activitythread(11115): activity br.com.pedmobiledroid.view.controller.loginactivity has leaked intentreceiver com.android.internal.policy.impl.multiwindow.multiphonewindowevent$1@42045be0 registered here. missing call unregisterreceiver()?
someone know better way properly?
just call finish()
on activitya
after starting activityb
:
intent intent = new intent(activitya.this, activityb.class); startactivity(intent); finish();
Comments
Post a Comment