I am opening splash activity once, this is what i have done.
public class StartupActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences settings = PreferenceManager .getDefaultSharedPreferences(StartupActivity.this); String lang = settings.getString("opened", ""); if(opened.equals("1") { Intent i = new Intent(getApplicationContext(), SecondActivity.class); startActivity(i); finish(); }else { //I am setting here opened to 1 setContentView(R.layout.activity_main);} }
Where does the problem lie? When I open the app first time, this activity shows setcontentview activity main, but second time user opens app it goes to secondactivity .But the problem is , for couple of milliseconds the second time i open the app it is making it obvious that splash activity is opening then closing for couple of milliseconds.