[Solved] @ validation for email in BlackBerry


Use EmailAddressEditField.. here is the way

EmailAddressEditField email=new EmailAddressEditField("Email Address: ", "");
        String address =email.getText();
            int at = address.indexOf("@");
            int len = address.length();
            String host = address.substring(at + 1, len);
            int dot = host.lastIndexOf('.');
            len = host.length();

            if (at <= 0 || at > len - 6  && dot < 0 || dot >= len - 3)
                Dialog.alert("Invalid email");
            else
            {
                 if (host.indexOf("..") >= 0)
                 {
                     Dialog.alert("Invalid email");
                 }
                 else
                 {
                     //correct mail id.. continue your process

                 }
            }

5

solved @ validation for email in BlackBerry