我只想在AutoCompleteTextView中的Text Completion之后调用一个方法。不可能将方法放在afterTextChanged旁边,它是根据文本更改连续调用方法。我想在Text Completion上只调用一次该方法。我怎么能这样做..请帮忙......
答案 0 :(得分:0)
试试这个:
private CustomAutoCompleteTextView mAutoFillTextView;
mAutoFillTextView.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(final CharSequence s, int start, int before, int count) {
String string = s.toString().trim();
if (mAutoFillTextView.getThreshold() <= string.length() && mAllowRequest) {
Toast.makeText(getActivity(), "OK : " + string, Toast.LENGTH_LONG).show();
} else if (string.equals("")) {
Toast.makeText(getActivity(), "OK : " + string, Toast.LENGTH_LONG).show();
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void afterTextChanged(Editable s) {}
});