2012-05-08 14 views

答えて

0

あなたは文字がのEditTextフィールドから入力されたか、削除されたときに呼び出されるのEditTextのためTextWatcherを登録することができます。

EditText editText = (EditText) findViewById(R.id.edit_text_field_id); 
editText.addTextChangedListener(new TextWatcher() { 

     @Override 
     public void beforeTextChanged(CharSequence s, int start, int count, int after) { 
      // This method is called to notify you that, within s, the count characters 
      // beginning at start are about to be replaced by new text with length after. 
     } 

     @Override 
     public void onTextChanged(CharSequence s, int start, int before, int count) { 
      // This method is called to notify you that, within s, the count characters 
      // beginning at start have just replaced old text that had length before. 
     } 

     @Override 
     public void afterTextChanged(Editable s) { 
      // This method is called to notify you that, somewhere within s, the text has 
      // been changed. 
     } 
     }); 

TextWatcherのドキュメントを参照してください。詳細については、

関連する問題