Hi there,

I am facing a problem I cannot solve. Somehow this is frustrating me.
What I want to do is, show an AlertDialog when a user enters an
invalid eMail address:
        Button saveButton = (Button) findViewById(R.id.save);
        saveButton.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                mUserNameText = (EditText) findViewById
(R.id.enterUserName);
                                mUserEmailText = (EditText)
findViewById(R.id.enterEmail);
                                long resultCode;

                                String userEmail =
mUserEmailText.getText().toString();
                                if (userEmail.length() > 0 &&
userEmail.matches("....@.+\\..+")) {
                                        resultCode =
mDbHelper.createUser(mUserNameText.getText().toString
(), userEmail);
                                } else {

                                        AlertDialog dialog = new
AlertDialog.Builder
(UserCreate.this).create();

                                        dialog.setMessage("Invalid
Email!");
                                        dialog.setButton2("OK", new
Message());

                                dialog.show();

                            resultCode = -1l;
                                }

The problem is that the dialog does't show!

The code is located in my class
> public class UserCreate extends Activity { ...}

I also tried AlertDialog.Builder with the same result.

Now I found out that I need a Handler, invoke the Looper and pack it
in a Thread.
But I cannot quite figure out how?!

Any help appreciated.

Many thanks in advance,
  Tommaso

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to