I have this code and i would like to use asyncTask manager with this to let the user know something is happening. How would i allow this to happen with this snippet of code. i cant seem to figure it out. I know the asyncTask will be better than using a Hanlder. Or would it?
But anyway here is an example. if anyone can help out. Please do. Thanks.
enter.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
item = book.getText().toString();
searchForItem();
}
});
i would like to run this method with a progress dialog spinner letting the user know something is happening. How do i do this, and stop the spinner when the web page is loaded?
Here is my SearchForItem().
public void searchForBook(){
String url = "www.example.com";
browser = (WebView)findViewById(R.id.shopView);
browser.setWebViewClient(new BookLookupbrowser());
browser.getSettings().setJavaScriptEnabled(true);
browser.loadUrl(url);
AsyncTask. Override the three main methods,onPreExecute,onPostExecute,doInBackground.onPreExecute, start yourProgessDialog.doInBackground, run yoursearchForBook()method.onPostExecute, dismiss yourProgressDialog.AsyncTask, more methods exist and are well documented in the documentation.AsyncTasksubclass, start it in theonClickmethod from your first snippet.Good Luck!