RT,在Android中如何獲得動態添加EditText的輸入文本內容?
search是一個TextView,類似於這樣處理就行了:
search.addTextChangedListener(new TextWatcher() {
//輸入後的串 qr 0 1 2
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
Message msg=Message.obtain();
msg.obj=s;
msg.what=0x123;
handler.sendMessage(msg);
Log.i("222", "onTextChangedCharSequence "+s+" start "+start+" before "+before+" count "+count);
}
//輸入前的串 q 0 1 2 after是此次添加文字的總數
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
Log.i("222", "beforeTextChangedCharSequence "+System.currentTimeMillis());
}
//輸入後的串 qr
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
Log.i("222", "afterTextChangedEditable "+System.currentTimeMillis());
}
});