onCreate() { super.onCreate(); Preference p = new Preference(this); if(p.getIsLoggedIn()) { finish(); // start another app activity here ... } // ... }
Preference myPrefs; Boolean val; public void onCreate(Bundle savedInstanceState) { myPrefs = new Preference (this); val = myPrefs.getIsLoggedIn(); if (val == true) { Intent inetnt = new Intent(getApplicationContext(), MainActivity.class); startActivity(inetnt); finish(); } else { Intent inetnt = new Intent(getApplicationContext(), LoginActivity.class); startActivity(inetnt); finish(); } }