android - Refocusing app to foreground restarts entire app -


i wondering if knows problem - have created app , i'm testing it, , problem every time put app in background or minimise it, when bring foreground again entire application restarts first activity intent. there way around this? can't feel i'm missing fundamental knowledge here?

my mainactivity shown below:  public class mainactivity extends activity {      private actionbar actionbar;      @suppresslint("newapi")     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          actionbar = getactionbar();         actionbar.sethomebuttonenabled(true);         actionbar.setdisplayhomeasupenabled(true);         actionbar.setdisplayoptions(actionbar.display_show_custom | actionbar.display_show_home);         actionbar.setcustomview(r.layout.abs_layout_main);         actionbar.seticon(android.r.color.transparent);    } 

so can see savedinstancestate being called on oncreate.

pressing button default close app. either have press home button instead or add custom logic onbackpressed() in order circumvent behaviour.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -