Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Validatng password ,conform password and passing a string value through Button

I have fields like password,conform password and gender in my registration page

password edit text

conform password edit text

gender (button01)/(button02)

for password and conform password i want to validate both fields ,I mean the entries(string value) of both fields should be same. If both are same then I want to pass only password value to the server not both values and In case of gender when I click button 01, I want to pass the input as male(string) to server and same in case of female also. How can I do this?

Help is always appreciated...!

like image 597
Randroid Avatar asked Jun 20 '11 09:06

Randroid


People also ask

What is the minimum character required for Change Password on Android?

Hi I am very new for android and in my app I have Validations for Change password page. That means the Password must contain minimum 8 characters at least 1 Alphabet, 1 Number and 1 Special Character, for this I tried the code below, but it's not working. Please help me.

What are the exceptions of confirmation password validation?

An exception is when the confirmation password doesn't match the first entry, that pops up a toast. It would be better to handle validation errors consistently, by using setError for mismatched confirmation password.

How to handle password validation errors in Salesforce?

Most validation errors call setError of the relevant input field. An exception is when the confirmation password doesn't match the first entry, that pops up a toast. It would be better to handle validation errors consistently, by using setError for mismatched confirmation password.


1 Answers

  • Check Password.

    Here i write one function for compare password and conform password . In that function you need pass both the password and it will return true if both password are same and return false if both are different.

     public boolean checkPassWordAndConfirmPassword(String password,String confirmPassword) 
     {
         boolean pstatus = false;
         if (confirmPassword != null && password != null) 
         {
           if (password.equals(confirmPassword)) 
           {
                pstatus = true;
           } 
         }
        return pstatus;
    }
    
  • Gender Button

    As you said that here you are taking two button for gender . One is for male and another is for female . so you when user click on male button you have to take one string variable and assing the "male" value to that string, if user click female then you have to set "female" to that variable and pass to the server.

like image 145
Chirag Avatar answered Oct 07 '22 00:10

Chirag