Correct way to do it:

put into  onWindowFocusChanged(boolean a)


it works!!

On Aug 21, 3:05 pm, cindy <[email protected]> wrote:
> no it is not working:
> In android document, it says:
> "
> It's important to note that the start() method called on the
> AnimationDrawable cannot be called during the onCreate() method of
> your Activity, because the AnimationDrawable is not yet fully attached
> to the window. If you want to play the animation immediately, without
> requiring interaction, then you might want to call it from the
> onWindowFocusChanged() method in your Activity, which will get called
> when Android brings your window into focus.
> "
>
> I put it in :
> onWindowFocusChanged()
>
> THe function onWindowFocusChanged() never get called. Why ?
>
> On Aug 21, 1:05 pm, skink <[email protected]> wrote:
>
> > On Aug 21, 8:48 pm,cindy<[email protected]> wrote:
>
> > > Hi Friend,
>
> > > I need to start a animation automatically for a activity without any
> > > user clicking. I know when activity is not ready, animation could not
> > > start. I used a thread to start it, however it is still not working.
>
> > > How could I know Activity is ready?
>
> > > Help is great appreciated.
>
> > > public void onCreate(Bundle savedInstanceState)
> > >     {
> > >         super.onCreate(savedInstanceState);
> > >         anim_record= (AnimationDrawable)img.getBackground();
> > >         Timer initTimer=new Timer();
> > >        Starter initRecord=new Starter();
> > >        initTimer.schedule(initRecord, 10000);
> > >                 //      anim_record.start();
>
> > >     }
>
> > >     class Starter extends TimerTask
> > >     {
> > >         public final void run()
> > >         {
> > >                 anim_record.start();
> > >                 startRecording();
> > >         }
>
> > >     }
>
> > use addIdleHandler of MessageQueue, hope it helps
>
> > pskink

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