android - How to run an activity only once like Splash screen -


in app, run splash screen once @ first run problem placed in manifest line: android:nohistory="true" works great if press button , exits app note app still in background running, , when press app icon goes again splash screen registration page. wanted redirected registration page directly when reopen application.

how do this? ahead suggestions.

this how achieved it!hope helps!

import android.app.activity;  import android.content.intent;  import android.content.sharedpreferences;  import android.os.bundle;  public class check extends activity{  @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);      sharedpreferences settings=getsharedpreferences("prefs",0);     boolean firstrun=settings.getboolean("firstrun",false);     if(firstrun==false)//if running first time     //splash load first time     {         sharedpreferences.editor editor=settings.edit();         editor.putboolean("firstrun",true);         editor.commit();         intent i=new intent(check.this,splash.class);         startactivity(i);         finish();     }     else     {          intent a=new intent(check.this,main.class);         startactivity(a);         finish();     } }  } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -