java - Android how to create notification that resumes activity instead of starting a new onw -


so i've read varios questions , i'ved tried implement said , doesnt work. when notification pressed want pull activity without clearing of edittexts or turning off toggle button. i.e resuming activity last state. far code doesnt work.

intent myintent = new intent(this,locator.class);  pendingintent pendingintent                 = pendingintent.getactivity(getbasecontext(),                 0, myintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top),                 intent.fill_in_data);         mynotification.defaults |= notification.default_sound;         mynotification.defaults |= notification.default_vibrate;         mynotification.flags |= notification.flag_auto_cancel; 

the android os solely responsible managing lifecycle of activity , can kill activity @ time, there no way specify resume activity. os bring requested activity top of stack if still in memory; if activity has been killed, launched again , saved state passed it.

see recreating activity


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -