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

  • SEARCH
  • Home
  • 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 8873073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:22:27+00:00 2026-06-14T18:22:27+00:00

I am making a program that requires a password for the settings page. Currently

  • 0

I am making a program that requires a password for the settings page. Currently how I’m going about that is by having an alert pop up with a text field and a request for a password. When the correct password is entered (currently hardcoded as “test” but that will be changed) it should start the settings activity, with an incorrect password resulting in an alert saying “incorrect”.

At the moment, regardless of right or wrong password it just closes the alert, no message or anything.

I’m learning as I go so I’m sure I’ve severely mauled the code, any suggestions?

  public void Settings(View view) {
    final AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("Main User Only");
    alert.setMessage("Please enter password");

    // Set an EditText view to get user input 
    final EditText input = new EditText(this);
    alert.setView(input);

    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int whichButton) {
        String value = input.getText().toString();
      if (value == "test") 
     {Intent settings = new Intent(Bootscreen.this, ItemListActivity.class);
     startActivity(settings);}

      else
          if (!(value == "test")) { alert.setMessage("Incorrect");}}

    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
        // Canceled.
      }
    });

    alert.show();

}
  • 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-14T18:22:29+00:00Added an answer on June 14, 2026 at 6:22 pm

    use

    if (value.equals("test"))
    

    instead of

    if (value == "test") 
    

    for comparing Strings

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

Sidebar

Related Questions

I am currently making a program that will send an email if the date
I am thinking about making a program that will need to send input and
I am making a program in C++ for Windows XP that requires sound to
I'm making a program that, for reasons not needed to be explained, requires a
I'm making a basic program that requires the use of all the letters' indices
Hello i am making a program that is supposed to copy a text file.
I am making a C++/Windows/DirectX program that requires the functions d3d = Direct3DCreate9(D3D_SDK_VERSION); and
Im am making an Java SWT program that is required to run on both
I am making a program that automates the seperation of a csv file. We
I am making a program that graphs a line based on data inputted by

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.