I have an edit text designed for search. I added
searchET.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub //intent to another page where i show my search result } });
The problem is this: When I give a search string, for example: "fort", I get the desired result on the next page. But when I click the back button, it does not move to the previous page on the first click. I will have to press the button 4 times to go to the previous page. This is because my search string is 4 in length and each time a value is entered into edittext, a textchangelistener is called. How can I solve this problem? Answer please. Thanks in advance.
source share