其他分享
首页 > 其他分享> > 带有搜索栏的Android密码强度检查器

带有搜索栏的Android密码强度检查器

作者:互联网

如何在androidenter image description here中使用seekbar创建密码强度检查器

解决方法:

您可以使用https://github.com/VenomVendor/Password-Strength-Checker满足您的要求

或使用TextWatcher检查EditText长度.就像这样

 public void afterTextChanged(Editable s)
                    {
                                 if(s.length()==0)
                                        textViewPasswordStrengthIndiactor.setText("Not Entered");
                                 else if(s.length()<6)
                                        textViewPasswordStrengthIndiactor.setText("EASY");
                                 else if(s.length()<10) 
                                        textViewPasswordStrengthIndiactor.setText("MEDIUM"); 
                                 else if(s.length()<15) 
                                        textViewPasswordStrengthIndiactor.setText("STRONG");
                                   else 
                                        textViewPasswordStrengthIndiactor.setText("STRONGEST");

                               if(s.length()==20)
                                   textViewPasswordStrengthIndiactor.setText("Password Max Length Reached");
                    }
            };

Demo Help

afterTextChanged (Editable s) – This method is called when the text
has been changed. Because any changes you make will cause this method
to be called again recursively, you have to be watchful about
performing operations here, otherwise it might lead to infinite loop.

标签:android,passwords,textwatcher
来源: https://codeday.me/bug/20190824/1708057.html