start animation???


Last Updated:

  1. Yati

    Yati New Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    4
    Likes Received:
    0
    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
     

    Advertisement
  2. gumatias

    gumatias Member

    Joined:
    Dec 4, 2009
    Messages:
    9
    Likes Received:
    0
    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
     
  3. jarkid

    jarkid New Member

    Joined:
    Dec 30, 2010
    Messages:
    1
    Likes Received:
    0
    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.
     

Share This Page

Loading...