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.

Animation takes a long time to "show"

See original GitHub issue

I’m trying to show a dialog with an animation while the user waits for the AsyncTask to finish.

To achieve this, I used the following code (inside AsyncTask)?

protected void onPreExecute() {
super.onPreExecute();
    //Custom Dialog
    customDialog = new Dialog(mContext);
    customDialog.setContentView(R.layout.dialog_custom);
    customDialog.setTitle("Looking for address");

    //Custom Dialog Animation
    LottieAnimationView animationView = (LottieAnimationView) customDialog.findViewById(R.id.animation_view);
    animationView.setAnimation("PinJump.json"); //Lottie's premade animation
    animationView.loop(true);
    animationView.playAnimation();

    //Custom Dialog Text
    TextView text = (TextView) customDialog.findViewById(R.id.textView);
    text.setText(R.string.dialog_looking_for_address);
    customDialog.show();
}

The code above works wonderfully.

The only problem is that the animation takes about north of 1 second to show up. So I end up seeing the text way before the animation.

Is there anyway to make the animation show up as soon as the dialog is up? I tried casting the json file directly to the XML, but no dice, same thing happened.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
gpealcommented, Apr 25, 2019

@MegBasutkar05 The APIs have moved to LottieCompositionFactory

0reactions
MegBasutkar05commented, Apr 25, 2019

LottieComposition.Factory.fromAssetFileName is deprecated now. So is there an alternative way to go about it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Does Animation Take So Long? | Video Production Bristol
There are a few reasons why animation still takes a long time to create, but we can argue that animation has become faster...
Read more >
Why does animation take so long? - Reddit
For some perspective, it can take an hour+ to get a simple ... Animation is a precise, time consuming art that one can...
Read more >
Why animations take a long time? Is there a way to use ...
Animation is hard, that's why it takes so long. Technology is already making it easier to make high-quality animation in shorter amounts of...
Read more >
How Long Does It Take To Produce an Animation?
A simple animated video with superficial details and without animated characters can be completed in around 4 weeks. However, more intensive scenes, with...
Read more >
Animation Lead Time - TV Tropes
Good animation takes a long time. Even the simplest animated TV shows can see a production period of a year for a single...
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