title: how to prompt user to enter a strong password which consists of capital, small letters, numbers and symbol?
body: <pre><code>public class LockAppActivity extends Activity{
  
      EditText pass1, pass2;
      Button back, next;
      SharedPreferences prefs;
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.lockapp);
  
          pass1 = (EditText) findViewById(R.id.edit1);
          pass2 = (EditText) findViewById(R.id.edit2);
  
          back = (Button) findViewById(R.id.back);
          back.setOnClickListener(new View.OnClickListener() {    
              public void onClick(View v1) {
                  Intent setIntent = new Intent(Intent.ACTION_MAIN);
                  setIntent.addCategory(Intent.CATEGORY_HOME);
                  setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  startActivity(setIntent); 
              }
          });
  
          next = (Button) findViewById(R.id.next);
          next.setOnClickListener(new View.OnClickListener() {
              String password1 = "";
              String password2 = "";
  
              public void onClick(View v){
  
                  password1 = pass1.getText().toString();
                  password2 = pass2.getText().toString();             
  
                  if (!password1.equals("")){
  
                      if (password1.length() &gt;= 15){
                          Pattern pattern = Pattern.compile("[[0-9]&amp;&amp;[a-z]&amp;&amp;[A-Z]]");
                          Matcher matcher = pattern.matcher(password1);   
  
                          if(matcher.matches()){                      
  
                              if (password1.equals(password2)){
                                  //SavePreferences("Password", password1);
                                  Intent intent = new Intent(LockAppActivity.this, PhoneNumActivity.class);
                                  startActivity(intent);
                              }
                              else{
                                  pass1.setText("");
                                  pass2.setText("");
                                  Toast.makeText(LockAppActivity.this,"Not equal",Toast.LENGTH_LONG).show();
                              }
                          }
                          else{
                              pass1.setText("");
                              pass2.setText("");
                              Toast.makeText(LockAppActivity.this,"Not matched",Toast.LENGTH_LONG).show();
                          }
                      }
                      else{
                          pass1.setText("");
                          pass2.setText("");
                          Toast.makeText(LockAppActivity.this,"Length",Toast.LENGTH_LONG).show();
                      }                       
                  }
                  else{
                      pass1.setText("");
                      pass2.setText("");
                      Toast.makeText(LockAppActivity.this,"Nothing",Toast.LENGTH_LONG).show();
                  }
              }
          });
      }
  
      private void SavePreferences(String key, String value){
          SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE);
          SharedPreferences.Editor editor = sharedPreferences.edit();
          editor.putString(key, value);
          editor.commit();
      }
  }
  </code></pre>
  
  <p>I faced problem when I entered a valid password but it pops out a toast stated "Not matched" and how I am going to save this password in the apps and when a newer password entered it will update and overwrite the old password</p>