title: How to avoid multiple triggers on EditText while user is typing?
body: <p>I use the following code to perform search when user types in an EditText : </p>
  
  <pre><code>EditText queryView = (EditText) findViewById(R.id.querybox);
  queryView.addTextChangedListener(new TextWatcher() {
    @Override
    public void afterTextChanged(Editable s) {
      triggerSearch(s.toString()); 
    }
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    }
  });
  </code></pre>
  
  <p>However, this triggers multiple times when the user is typing a word. That is if the user is typing "hello", this code will trigger 5 times with values ("h", "he" , "hel", "hell", "hello"). Normally, this would be fine but the triggered search is expensive and I don't want to waste resources on intermediate searches that are of no great use. What I want is either a listener that triggers only a certain threshold after the user starts typing, or some kind of framework, that waits in the listener before calling <code>triggerSearch</code>, and if another event is triggered before that wait, cancels itself.</p>