I am trying to implement a search bar that automatically searches as you type.
My idea is to have an AsyncTask which fetches the search data from the server, but I can't figure how exactly AsyncTask will behave with my use of it.
Let's say I have SearchAsyncTask.
Every time the text field is edited I will call
new SearchAsyncTask().execute(params);
So here's my question: what will the behavior of this be? Will I be starting many different threads which will all return and call onPostExecute()? Or will the first task called be stopped mid-task if another instance is called while it's still working? Or something totally different?
What if I write it this way?
SearchAsyncTask a = new SearchAsyncTask().execute(params);
...
a.execute(params2);
a.execute(params3);
...