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 8875551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:00:02+00:00 2026-06-14T19:00:02+00:00

im new in developing Android Apps. I know how to set the starting Activity

  • 0

im new in developing Android Apps.
I know how to set the starting Activity with the AndroidManifest.xml, but i need a way to check something first before i choose the starting Activity.

My Problem:
I created a loginActivity and a mainActivity.
I want to do the following: If i log me in, i’ll set a flag to 1 and at the next app start, i want show directly the mainActivity and not the login.

Is there any way to do that? I thought about creating a splashscreen where i can check if im logged in before showing the first Activity.

Thanks, Philip

Updated Code – working:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // get preferences
    SharedPreferences userDetails = getApplicationContext().getSharedPreferences("userdetails", 0);
    String savedEmail = userDetails.getString("email", "");
    String savedPassword = userDetails.getString("password", "");
    Boolean savedRemember = userDetails.getBoolean("remember", false);
    Boolean savedLogged = userDetails.getBoolean("logged", false);

    // check if already logged in
    if(savedLogged) {
        // start the overview
        Intent intent = new Intent(this, ActivityOverview.class);
        startActivity(intent);
        finish();
    }
    else {
        // initialize the form layout
        setContentView(R.layout.activity_login);

        // get views
        this.email = (EditText)findViewById(R.id.editTextEmail);
        this.password = (EditText)findViewById(R.id.editTextPassword);
        this.remember = (CheckBox)findViewById(R.id.checkBoxRemember);

        // set values to views
        this.email.setText(savedEmail);
        this.password.setText(savedPassword);
        this.remember.setChecked(savedRemember);
    }
}
  • 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-14T19:00:07+00:00Added an answer on June 14, 2026 at 7:00 pm

    I have something similar in one of my apps. I let the user chose weather it should auto-login or not. This is saved in the SharedPreferences.

    When the app starts and in the mainpage, you should check – BEFORE the setContentView(R.layout.activity_login); and set finish(); after startActivity();

    if(savedLogged) {
    
        Intent intent = new Intent(this, ActivityOverview.class);
        startActivity(intent);
        finish();
    }
    setContentView(R.layout.activity_login);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new developing android and web apps, I would like to know if is
I am brand new to developing for android and have hit something of a
I'm quite new to developing Android apps. Basically I'm making a webview template to
Hello i am new in developing Android applications, I need to create an application
I am fairly new to developing android apps. What I am trying to do
I'm new to developing apps in Android. We are currently creating a robot using
I'm writing a puzzle game to learn developing Android Apps. But now I'm stuck
I am new to Android code development...I am developing a Android calculator apps and
I am new to developing android apps. I am making an app where simple
I'm pretty new to developing Android applications but I am attempting to display 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.