editText= (EditText)findViewById(R.id.text);
editText.addTextChangedListener(textWatcher);
private TextWatcher textWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
// doSearchMethod();
Log.e("111", "改中");
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
Log.e("111", "改前");
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
doSearchMethod();
Log.e("111", "改完");
}
};
private void doSearchMethod(){
String keyword = editSearch.getText().toString();
if (GlobalInfo.SOFTPRODUCTLIST.get(i).getName().indexOf(keyword) >= 0) {
//处理代码
}
}