question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error when startanimation()

See original GitHub issue

Beautiful animation. I have a problem when init call mBtLogin.startAnimation(), animation not load full in onCreate. I fix it as put startAnimation in a Handler().postdelay. How to direct call startAnimation() when start app. Thanks.

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       CircularProgressButton mBtLogin = (CircularProgressButton) findViewById(R.id.progress_btn_change_activity);
        mBtLogin.startAnimation();
        /*new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                mBtLogin.startAnimation();
            }
        }, 100);*/
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mradzinskicommented, May 6, 2017

@leandroBorgesFerreira, sorry to disagree, but this doesn’t require much of a fix. onCreate() is not supposed to be used for animating things nor explicit app logic (such as Login) as this can lead to several issues such as lagging due to early fired GC’s and others. @frankenten13, you should read about the activity lifecycle and when are you supposed to invoke certain parts of your code. Invoking a Login function during onCreate() is a pretty terrible design decision; you are delaying your activity creation process.

As per Android documentation:

In the onCreate() method, you perform basic application startup logic that should happen only once for the entire life of the activity.

0reactions
leandroBorgesFerreiracommented, Jan 7, 2019

This problem was already fixed. The button accepts animation commands before the screen get drawn and waits for the right time for the animation to start.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animation does not play when startAnimation is called in ...
Describe the bug When calling startAnimation in a RecyclerView's onBindViewHolder, the animation does not play. This issue was partially ...
Read more >
Android Animation Error - Stack Overflow
And you are using twice the animation "sol". ... setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resim.
Read more >
Animation | Jetpack Compose - Android Developers
Jetpack Compose provides powerful and extensible APIs that make it easy to implement various animations in your app's UI. This document describes how...
Read more >
Animation QML Type | Qt Quick 6.4.1
Attempting to use the Animation type directly will result in an error. ... either by setting the running property to false, or by...
Read more >
An Easy Error Animation for Android | HCSS Career Center
Now to apply it to a view, it's as simple as: Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.shake_error); view.startAnimation( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found