Search code examples
androidpasswordstextwatcher

Android Password Strength checker with seekbar


How to Create Password Strength checker with seekbar in android ?enter image description here


Solution

  • You can use https://github.com/VenomVendor/Password-Strength-Checker for your requirement

    or use TextWatcher for checking EditText length .Like this way

     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.