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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:21:18+00:00 2026-05-21T15:21:18+00:00

I’m trying to create a generic login screen for Android. I’d like the program

  • 0

I’m trying to create a generic login screen for Android. I’d like the program to check if the username and password (currently hardcoded) is listed. If the account is listed, you will be taken to a new screen called menuTest. I have the basic login working (without activity or intents). But when I try to add the intents, I get an error. How can I fix this? Below is my sample code.

Below are a few links containing screenshots of crash and logcat (edit: links are dead).

https://i.stack.imgur.com/ve7OL.png

https://i.stack.imgur.com/KLeQa.png

Thanks.


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class Login extends Activity {
    // Declare our Views, so we can access them later
    private EditText etUsername;
    private EditText etPassword;
    private Button btnLogin;
    private Button btnCancel;
    private TextView lblResult;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set Activity Layout
    setContentView(R.layout.login);

    // Get the EditText and Button References
    etUsername = (EditText)findViewById(R.id.username);
    etPassword = (EditText)findViewById(R.id.password);
    btnLogin = (Button)findViewById(R.id.login_enter);
    btnCancel = (Button)findViewById(R.id.login_cancel);
    lblResult = (TextView)findViewById(R.id.result);

    // Set Click Listener
    btnLogin.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // Check Login
            String username = etUsername.getText().toString();
            String password = etPassword.getText().toString();

            if(username.equalsIgnoreCase("USER") && password.equals("132465")){
                //lblResult.setText("Login successful");
                Intent loginIntent = new Intent(this, menuTest.class);
                startActivity(loginIntent);
            }

            else {
                lblResult.setText("Login Failed");
            }
        }
    });


    btnCancel.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // Close the application
            finish();
        }
    });
}
}
  • 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-21T15:21:19+00:00Added an answer on May 21, 2026 at 3:21 pm

    try changing Intent loginIntent = new Intent(this, menuTest.class); to Intent loginIntent = new Intent(Login.this, menuTest.class);

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is 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.