You cannot call startAnimation() from a non-UI thread (which is what would
happen with a Timer.)

On Wed, Mar 9, 2011 at 5:22 PM, Jeff Meyerhoff <[email protected]> wrote:

> The problem persists.  By having the startAnimation in the view's
> onClick, it fires just fine.  The problem starts as soon as I move it
> into a Runnable or TimerTask called by either a Handler or Timer
> respectively.
>
> Basically what I'm doing is this:
>
>        private Runnable fadeInInfo = new Runnable() {
>                public void run() {
>
> findViewById(R.id.TextViewInformation).startAnimation(animationFadeIn);
>                }
>        };
>
>        View.OnClickListener clickListener = new View.OnClickListener() {
>                public void onClick(View v) {
>                        handle.postDelayed(fadeInInfo, 2000);
>                }
>        };
>
> On Mar 9, 5:55 pm, Dianne Hackborn <[email protected]> wrote:
> > Oh definitely just don't use Timer.  It is only trouble when interacting
> > with the Android frameworks. :}
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Mar 9, 2011 at 3:49 PM, Mark Murphy <[email protected]>
> wrote:
> > > Also, instead of a Timer, try using postDelayed() on the Handler (or
> > > any View) for your delay, and see if that helps.
> >
> > > On Wed, Mar 9, 2011 at 6:45 PM, Dianne Hackborn <[email protected]>
> > > wrote:
> > > > A working API demo is here:
> >
> > >http://developer.android.com/resources/samples/ApiDemos/src/com/examp.
> ..
> > > > That seems to be what you are describing that you do, but there must
> be
> > > > something different.  Try reducing your code to that and seeing where
> it
> > > > starts working.
> >
> > > > On Wed, Mar 9, 2011 at 3:09 PM, Jeff Meyerhoff <[email protected]>
> wrote:
> >
> > > >> I am trying to start an animation after a delay from a Timer.
> > > >> However, calling startAnimation() does not, well, start the
> > > >> animation.  The animation that I set up with View.startAnimation()
> > > >> only happens once I either touch the screen or scroll the scroll
> ball.
> >
> > > >> I have tried using a Handler, using runOnUiThread(), and neither to
> > > >> see if it was an issue with not being on the UI thread.  Any help
> you
> > > >> can give would be greatly appreciated.  This thing is killing me.
> >
> > > >> --
> > > >> 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
> >
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > [email protected]
> >
> > > > Note: please don't send private questions to me, as I don't have time
> to
> > > > provide private support, and so won't reply to such e-mails.  All
> such
> > > > questions should be posted on public forums, where I and others can
> see
> > > and
> > > > answer them.
> >
> > > > --
> > > > 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
> >
> > > --
> > > Mark Murphy (a Commons Guy)
> > >http://commonsware.com|http://github.com/commonsguy
> > >http://commonsware.com/blog|http://twitter.com/commonsguy
> >
> > > Android Training Worldwide:http://commonsware.com/training
> >
> > > --
> > > 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
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
>
> --
> 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
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them

-- 
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