Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip LoginActivity after a successful try the first time you run the Android app

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 ?


Edit:

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.

like image 958
Jeff Edward Avatar asked Jan 27 '26 02:01

Jeff Edward


1 Answers

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.

like image 126
Damian Kozlak Avatar answered Jan 31 '26 22:01

Damian Kozlak