• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps start animation???

Yati

Lurker
Hi,
I am very new to this forum.

When i start my project there is an license agreement page where i can acceot and deny and after it goes directly to the animation page.
I am facing a problem in animation part,when i go to that page my animation does not start immediately,whenever i click something the animation starts,i want it to start immediately without clicking event.
So please help me with the problem,it would be highly appreciated.

Thanks
 
I'm not quite sure about what you're trying to accomplish. but maybe placing your code on either onCreate() or onStart() might help.

-gustavo
 
I finally found the answer to this question. I couldn't run the animation directly when I wanted to put the code on OnStart();

Now I finally found a solution to this.

You should use a handler to delay the execution in order to run immediately on initial.

private Handler handler = new Handler();

@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.loading);
ImageView line = (ImageView) findViewById(R.id.loading_line);
handler.postDelayed(new Runnable()
{
public void run()
{
AnimationDrawable frameAnimation =
(AnimationDrawable) line.getBackground();
frameAnimation.start();
}
}, 50);

}


This could run fine.
 
Back
Top Bottom