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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:39:17+00:00 2026-05-26T12:39:17+00:00

I am creating a login screen for my application with more than 1 authentication.

  • 0

I am creating a login screen for my application with more than 1 authentication. Now when i login the app with the first name and password, then it works but when i try the other names and password then it force closes the application.

I am using If and Else for the login Screen.

if (uName.equals("A") && uPass.equals("123")) 
{
    Intent cardSummaryScreen = new Intent(LoginActivity.this, Hi.class);
    b = new Bundle();

    EditText text1 = (EditText)findViewById(R.id.inputUserName);
    b.putString("name", text1.getText().toString());
    hi.putExtras(b);

    startActivity(hi);
}

else if(uName.equals("sumit") && uPass.equals("456")) 
{
    Intent cardSummaryScreen1 = new
    Intent(LoginActivity.this,Hi.class);

    Bundle c= new Bundle();
    EditText text2= (EditText)findViewById(R.id.inputUserName);
    c.putString("name",text2.getText().toString());

    startActivity(cardSummaryScreen1);
  • 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-05-26T12:39:17+00:00Added an answer on May 26, 2026 at 12:39 pm

    Even though you didn’t post a stacktrace, I think I can see where your app gets the error and force closes.

    In your second IF/ELSE statement, you try to add extra data to your new hi1 intent.
    However, you’re trying to add b. This does not exist in your second statement, only in the first.

    Therefore your app is trying to add data that doesn’t exist, giving it a NullPointerException and force closing.

    Intent hi1 = new
                  Intent(LoginActivity.this,Hi.class);
    
    
                  Bundle c= new Bundle();
    
                  EditText text2= (EditText)findViewById(R.id.inputUserName);
    
                  c.putString("name",text2.getText().toString());
                  hi1.putExtras(b); // b does not exist. This causes a NullPointerException
                  startActivity(hi1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a login screen for an application in C#. In my login
I'm creating an application in Qt (Nokia SDK) which should hold a login screen,
I am creating app for jobsite. It will display login page first. when we
HI, i am creating an login screen to my iphone application. i am sending
I am creating a login system for a web application using PHP. My question
I implemented Forms authentication by creating Default.aspx and custom login page named login.aspx .
I am creating a login screen and I want to add an header to
I'm trying to create a simple username/password login screen. I have the layout done,
I'm creating an application whose main screen can consist of one of three Scenarios.
This is more of a theoretical question rather than language specific, but I'm mostly

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.