Start with different activity on first launch of android app -


is there way launch different activity on startup once only? if instantly launch setup activity main activity, there 1 second pause white screen.

    @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          intent myintent = new intent(this, home2.class);         this.startactivity(myintent);         finish();         ...      } 

that can done in several ways. 1 of them usage of shared preferences stored data accessed activity (for example intro activity).

sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(getbasecontext()); boolean isaccessed = prefs.getboolean(getstring(r.string.is_accessed), false); if(!isaccessed) {     sharedpreferences.editor edit = prefs.edit();     edit.putboolean(getstring(r.string.is_accessed), boolean.true);     edit.commit();     showintroactivity(); } else {     startreqularactivity(); } 

also there more ways accomplish request (for example -> storing accessing state in db, or properties file, or storing on cloud if application have controlled office). imo best way achieving functionality - , of course simplest.

this idea (which functional) , can adapt needs.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -