安卓:Validatng密码,密码相符并传递一个字符串值,通过按钮 [英] Android: Validatng password ,conform password and passing a string value through Button

查看:177
本文介绍了安卓:Validatng密码,密码相符并传递一个字符串值,通过按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个密码字段,在我的注册页面符合密码和性别

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

密码编辑文本

符合密码编辑文本

性别(button01)/(button02)

gender (button01)/(button02)

有关密码和密码相符我想验证这两个领域,我的意思是这两个领域的条目(字符串值)应该是一样的。如果两者相同的话,我只想密码值传递给服务器不能同时价值观和性别的情况下,当我点击按钮01,我想通过输入作为男性(字符串)到服务器,并同女性的情况下也。我怎样才能做到这一点?

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?

帮助总是AP preciated ...!

Help is always appreciated...!

推荐答案


  • 确认密码。

  • Check Password.

    在这里,我写的比较密码,密码相符一个功能。在该功能
      你需要通过密码和如果两个密码都相同,它会返回true
      返回false,如果两者是不同的。

    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

    就像你说的,在这里你正在服用的性别两粒扣。之一为雄性而另一个为女性。所以你当用户点击你必须需要一个字符串变量男性按钮,assing男性的价值该字符串,如果用户点击的女性,那么你必须设置女性该变量,并传递给服务器。

    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.

    这篇关于安卓:Validatng密码,密码相符并传递一个字符串值,通过按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆