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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:31:29+00:00 2026-05-27T18:31:29+00:00

OK I am trying to make a app which will only accept 1 word

  • 0

OK I am trying to make a app which will only accept 1 word of any text.I am use the edittext to let the user put in the text and button for them to give them a toast with the words your incorrect or correct

The problem is when i use the if statement i cant get it to work can some one please identify the problem here is my code

public class IfActivity extends Activity {
Button GO;
EditText TEXT;

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

    GO = (Button) findViewById(R.id.go);
    TEXT = (EditText) findViewById(R.id.Textin);

    GO.setOnClickListener(new View.OnClickListener() {

        public void onClick(View arg0) {
            // TODO Auto-generated method stub

            if ("hello".equals(TEXT)) {
                Toast andEggs = Toast.makeText(IfActivity.this,
                        "PASSWORD IS CORRECT", Toast.LENGTH_SHORT);
                andEggs.show();
            } else {
                Toast andEggs = Toast.makeText(IfActivity.this,
                        "PASSWORD IS INCORRECT", Toast.LENGTH_SHORT);
                andEggs.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-05-27T18:31:30+00:00Added an answer on May 27, 2026 at 6:31 pm

    Use this:

     public void onClick(View arg0) {             
     // TODO Auto-generated method stub              
     String tempTxt = ((EditText) findViewById(R.id.Textin)).getText().toString();
     if ("hello".equals(tempTxt )) {
         Toast andEggs = Toast.makeText(IfActivity.this,"PASSWORD IS CORRECT",Toast.LENGTH_SHORT);
         andEggs.show();
      } 
     else{
       Toast andEggs = Toast.makeText(IfActivity.this,"PASSWORD IS INCORRECT",Toast.LENGTH_SHORT);
       andEggs.show();
       }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a jogging app which will track where the user
I am trying to make an Android app which will pull uploaded videos from
I'm trying to make my app a good Windows citizen, so I use matching
I am trying to make an app that will pass data between two servers
Let me try to explain my challenge. I'm building a Silverlight app which will
I'm about to make a web app which will have a pretty heavy client
I am trying to make an app whereby a picture will be shown, there're
I'm trying to create a Django app where the user can make a list
I am currently trying to make a broadcast receiver which will invoke after android
I'm trying to make my app publish to all my friend's walls. From what

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.