Android set back button to last activity -
i have 2 activities i'll phone call activity , activity b. activity , activity b both have button take them final activity. because can arrive @ final activity different ways, cannot set parent , navigate that. how can set things knows activity used lastly , go one?
in activity / b when phone call c use:
intent intent = new intent(this, activityc.class); intent.putextra("caller", "activityclassname"); startactivity(intent); in activity c:
@override public void onbackpressed() { bundle extras = getintent().getextras(); if (extras != null) { string value = extras.getstring("caller"); startactivity(this, class.forname(value)); } } android android-activity parent back
No comments:
Post a Comment