Interrupt Progress Dialog

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Interrupt Progress Dialog

Postby vimana » Thu Nov 05, 2009 10:00 pm


I want to be able to interrupt the progress dialog box while it is waiting for a lengthy operation to complete.
Here is what I am doing:
I have an activity which has a set of buttons at the top and a webview below.
When a user clicks on one of the buttons, it dispatches a request to load the url in the webview. A progress dialog box is displayed as the user waits for the process to complete. Now, I want the user to be able to click on another button. Doing so will cancel the current request to load the url, dismiss the progress dialog box and restart the same process but for the new url.
I don't know how I can allow the user to click anything on the screen when the progress dialog box is displayed.
Is this possible? If so, how can I implement this?

Posts: 2
Joined: Mon Jul 27, 2009 12:34 am


Postby divestoclimb » Thu Nov 19, 2009 6:29 pm

  1. Build a custom layout for your progress dialog if you need a button
  2. Add a OnClickListener for your button that calls interrupt() on your worker thread
  3. Have your worker thread periodically check to see if it's been interrupted with Thread.interrupted(), then respond accordingly
I do something similar in one of my apps: ...
divestoclimb - Android SCUBA app developer
Android Community | Gas Mixer, ScubaLib, Scuba Tanks | d2c Checklist
All code is open source under Apache license.
Posts: 33
Joined: Mon May 11, 2009 7:46 pm


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 1 guest