I'm new to Java/Android programming. I'm getting to know how the layout works and how to redirect it. I've got a splash screen > login > main . Now I want to skip the login activity. How can I do it ?
This is what my code looks like now, after answer:
SharedPreferences prefs = getSharedPreferences("myPref", 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("Bool", true);
editor.commit();
How I check from my Splashscreen:
SharedPreferences prefs = getSharedPreferences("myPref", 0);
if (prefs.getBoolean("Bool", false)) { //login_activity; }
else{ //maint_activity;
I think this would work.
You can use SharedPreferences
to store some boolean
value like skipLogin
. During splash screen you can check this value, and display login or main, depending on result.