Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8631009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:09:25+00:00 2026-06-12T09:09:25+00:00

Right now I am trying to create one Android application, assume it is going

  • 0

Right now I am trying to create one Android application, assume it is going to be some “X” concept okay. So I am creating one login screen. What I want to do is at once if I logged in that application on my mobile, it should always be logged in whenever I try to access that application.

For example our Facebook, g-mail and yahoo etc.. in our mobile phones

What to do for that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:09:25+00:00Added an answer on June 12, 2026 at 9:09 am

    Use Shared Preference for auto login functionality. When users log in to your application, store the login status into sharedPreference and clear sharedPreference when users log out.

    Check every time when the user enters into the application if user status from shared Preference is true then no need to log in again otherwise direct to the login page.

    To achieve this first create a class, in this class you need to write all the function regarding the get and set value in the sharedpreference. Please look at this below Code.

    public class SaveSharedPreference 
    {
        static final String PREF_USER_NAME= "username";
    
        static SharedPreferences getSharedPreferences(Context ctx) {
            return PreferenceManager.getDefaultSharedPreferences(ctx);
        }
    
        public static void setUserName(Context ctx, String userName) 
        {
            Editor editor = getSharedPreferences(ctx).edit();
            editor.putString(PREF_USER_NAME, userName);
            editor.commit();
        }
    
        public static String getUserName(Context ctx)
        {
            return getSharedPreferences(ctx).getString(PREF_USER_NAME, "");
        }
    }
    

    Now in the main activity (The “Activity” where users will be redirected when logged in) first check

    if(SaveSharedPreference.getUserName(MainActivity.this).length() == 0)
    {
         // call Login Activity
    }
    else
    {
         // Stay at the current activity.
    }
    

    In Login activity if user login successful then set UserName using setUserName() function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am right now trying to create a bar-chart in android using achartengine,hopefully i
Right now i am trying to create a graph in android by self learning.After
Right now I am trying to create a producer/consumer thread, the producer thread goes
Right now I'm trying to create my own tiny MVC (just for practice and
I'm trying to create a faster query, right now i have large databases. My
So I'm trying to create a forum with avatars, but right now the text
What I'm trying to do right now is to create an array with a
I'm trying to create a ProgressDialog for an Android-App (just a simple one showing
As of right now I am trying to create an ASP.NET page which will
I have an issue right now with a program im trying to create. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.