pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: ActivityIndicator Question
Date Sat, 26 Mar 2011 16:21:23 GMT
Have a look at this tutorial page

It sounds like you might want something similar to the 'Execute
Asynchronously' button.

You can create a Task and TaskListener.  The Task will be your code which
might take a long time to run.  The TaskListener has taskExecuted() and
executeFailed() method which can be used to stop the ActivityIndicator once
the task has finished.



On 26 March 2011 23:02, Le Zhou <lezhouyang@gmail.com> wrote:

> Hi all,
> i'm kinda confused by the ActivityIndicator Class. Is the
> ActivityIndicator.setActive() invoked by
> ButtonPressListener.buttonPressed(Button button) directly or indirectly will
> not become effective until the PushButton is released?
> Here is my question, I have one PushButton to start a computing task, as
> the computing task might run for pretty long time, I need to use
> ActivityIndicator to let people who started the computing task by pressing
> the PushButton know that the task is still running in the background and
> everything is all right, so i have some code like below:
> ActivityIndicator activityIndicator =
> (ActivityIndicator)namespace.get("activityIndicator");
> PushButton pushButton = (PushButton)namespace.get("pushButton");
> pushButton.getButtonPressListeners().add(new ButtonPressListener() {
>         @Override
>         public void buttonPressed(Button button) {
>                 activityIndicator.setActive(true);
>                 startComputingTask();
>                 activityIndicator.setActive(false);
>         }
> }
> Code above doesn't work, the activityIndicator never becomes "active", then
> i moved "activityIndicator.setActive(true);" to the first line in the
> function body of startComputingTask(), and moved
> "activityIndicator.setActive(false);" to the last line in the function body
> of startComputingTask(), it doesn't work either...
> i'v no idea about how to use the ActivityIndicator to solve my problem.
> Anyone can help me? Thanks a lot!

View raw message