I know how can we use the horizontal Progress bar from this link http://android-er.blogspot.in/2010/11/progressbar-running-in-asynctask.html
But I want to stop the running progress bat in between if my task is finished. I tried stop() and resume() methods but not worked.
I want to stop the running one and then restart it on click of some dialog box ok button.
I am new in android. Please support me.
I know how can we use the horizontal Progress bar from this link http://android-er.blogspot.in/2010/11/progressbar-running-in-asynctask.html
Share
If you are willing to resume stop a process that is being executed in a thread or an Asynctask the best way would be using a handler and sending messages that would act as requests to the process itself.
Sending a stop message (you define the message) so the process will handle the message and stop the thread and notify the main thread that is has been stopped.
Here are some useful articles about thread messageing and handlers:
For example you could implement an animation with handlers sending messages to a handler which then executes an animation step, the step will then send another message to execute the next step: http://code.google.com/p/android-page-curl/source/browse/trunk/src/com/mystictreegames/pagecurl/PageCurlView.java
Here are some examples of a digg like app I made a while ago: http://code.google.com/p/meneameandroid/source/search?q=handleMessage&origq=handleMessage&btnG=Search+Trunk