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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:36:00+00:00 2026-05-24T06:36:00+00:00

*edit*Sorry for the trouble, the reason for the bug was because I accidentally gave

  • 0

*edit*Sorry for the trouble, the reason for the bug was because I accidentally gave the findViewById(R.id.editTextemail2) to another edit text, which caused it to screw up.

I am trying to create a warning message to people who don’t type in a proper email (no ‘.’ or ‘@’) and a second message to people who don’t type the confirmation email exactly as the original. Can some one explain why my alert dialog only works for the first one and not the second one even though the code is nearly identical? The alert dialog is supposed to pop up once the person is done editing the text (leaves the edit text focus) Thanks!

email = (EditText) findViewById(R.id.editTextemail);
email2 = (EditText) findViewById(R.id.editTextemail2);
email.setOnFocusChangeListener(new OnFocusChangeListener() {

@Override
public void onFocusChange(View arg0, boolean hasFocus) {
    // checks if it is a proper email
    if (!hasFocus) {
        if (!hasPeriod(email.getText().toString())
                || !hasAt(email.getText().toString())) {

            new AlertDialog.Builder(CreateAccount.this)
                    .setTitle("Error")
                    .setMessage(
        "Please enter a properly formatted email address to continue")
                    .setNeutralButton("OK", null).show();

        }

    }
}
});

email2.setOnFocusChangeListener(new OnFocusChangeListener() {

@Override
public void onFocusChange(View arg0, boolean hasFocus) {
    // checks if it is a proper email
    if (!hasFocus) {
        if (!email.getText().toString()
                .contentEquals(email2.getText().toString())) {
                new AlertDialog.Builder(CreateAccount.this)
                    .setTitle("Error")
                    .setMessage(
            "Please verify your email addresses match")
                .setNeutralButton("OK", null).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-24T06:36:00+00:00Added an answer on May 24, 2026 at 6:36 am

    I think you should use equals instead of contentEquals

     if (!email.getText().toString().equals(email2.getText().toString())) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Link should work now, sorry for the trouble I have a text file
How to convert a multimap<int,int> to vector<pair<int,int> > efficiently EDIT: Sorry for the trouble
EDIT: Sorry I forgot to mention, I'm not using the implemented sha512 crypt because
EDIT Sorry I forgot the most important part here. Each key can have more
IMPORTANT EDIT: Sorry everyone, i made a big mistake in the structure. char *name;
Is there a .net equivalent to the C++ unexpected()/set_unexpected() functionality? Edit: Sorry--I omitted some
Edit: I am using SqlDataAdapters to fill the data sets. Sorry--I should have been
Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls
Edit: When I say SQL Server, I'm really talking about the Management Studio. Sorry
Sorry if this question will sound too chaotic, feel free to edit it. I

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.