On Thu, Dec 23, 2010 at 8:31 AM, Kostya Vasilyev <[email protected]> wrote:

> 23.12.2010 19:08, CasaDelGato пишет:
>
>  I must be doing something wrong with the animation, but I haven't been
>> able to figure out what.
>>
>
> You are calling an Android UI framework method from a background thread,
> and that's not allowed.
>
> The UI portion of the framework is not thread-safe, and the consequences
> are undefined.
>
> This link has a pretty clear description of the issue, as well as proper
> Android code patterns for this:
>
> http://developer.android.com/resources/articles/painless-threading.html
>

Thanks, that does help.  I figured it was something like that, I just
couldn't find the correct docs.
Now, I have the problem that my animation won't repeat.
It plays just once.

My onCreate does this:
        testAnimation = AnimationUtils.loadAnimation(getBaseContext(),
R.anim.testanim);
        testAnimation.setAnimationListener(mAnimationListener);
        testAnimation.setDuration(3000);
        testAnimation.setRepeatCount(10);
        testAnimation.setRepeatMode(Animation.RESTART);

and my onClick does this:
            if (running) { // Currently running, stop it
                button.setText(R.string.Button01);
                testShape.clearAnimation();
            } else { // Currently stopped, start it
                button.setText(R.string.BtnStop);
                testShape.startAnimation(testAnimation);
            }

The animation plays exactly once, and the listeners onAnimationStart() is
called exactly once.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to