title: how to save Editable s value in afterTextChanged?
body: <p>I am going to save the value in one textview after the length of input string is fulfilled. but saved value is empty if the value of textview is used. If Editable <strong>s</strong> value in afterTextChanged is used, it causes crash.</p>
  
  <p>Some codes as following:
  <code>number = (EditText) findViewById(R.id.number);
  final String numberStr = number.getText().toString();</code></p>
  
  <p>if following afterTextChanged is used, empty value is saved even I already input sth.</p>
  
  <pre><code>  @Override
    public void afterTextChanged(Editable s) {
              if (s.length() == 11) {
                  Toast.makeText(MainActivity.this, numberStr , Toast.LENGTH_SHORT).show();
                  saveSettingNote(MainActivity.this, "number_save", "number", numberStr);
                  number.setText(getSettingNote(MainActivity.this,"number_save", "number"));
              } 
          }
  </code></pre>
  
  <p>if following code is used, it will cause crash:</p>
  
  <pre><code>   @Override
     public void afterTextChanged(Editable s) {
  
              if (s.length() == 11) {
                  Toast.makeText(MainActivity.this, s.toString(), Toast.LENGTH_SHORT).show();
                  saveSettingNote(MainActivity.this, "number_save", "number", s.toString());
                  number.setText(getSettingNote(MainActivity.this,"number_save", "number"));
              } 
          }
  </code></pre>
  
  <p>Saving and getting are based on SharedPreferences, which works well in other situation.</p>
  
  <p>Actually, what I want to implement is saving String after the criteria is fulfilled for input string.</p>
  
  <p>Please help to identify what is wrong in above code or suggest a new to get that function. Thanks a lot in advance.</p>