title: "realtime" search using AsyncTask?
body: <p>I am writing an application that searches a database in "realtime".
  i.e. as the user presses letters it updates a search results list.</p>
  
  <p>Since the search can take a while, I need to do the search in background and allow new key presses to re-start a search. So that is a user presses 'a' (and the code starts searching for "a"), then presses 'b' - the code will NOT wait for "a" search to end, then start searching for "ab", but rather STOP the "a" search, and start a new "ab" search.</p>
  
  <ul>
  <li>To do that I decided to do the search in an AsyncTask. Is this a wise decision ?</li>
  </ul>
  
  <p>Now - whenever a keypress is detected, I test to see if I have an AsyncTask running. If I do - I signal it (using a boolean within the AsyncTask) it should stop. Then set a timer to re-test the AsyncTask within 10 mSec, to see if it terminated, and start the new search.</p>
  
  <ul>
  <li>Is this a smart method ? Or is there another approach you would take ?</li>
  </ul>
  
  <p>TIA</p>