Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException on ValueAnimator #5

Open
Zhelyazko opened this issue Dec 14, 2017 · 3 comments
Open

NullPointerException on ValueAnimator #5

Zhelyazko opened this issue Dec 14, 2017 · 3 comments

Comments

@Zhelyazko
Copy link

I've got a NPE when updating the visibility of LoadingDots to Visible.

Stacktrace:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.animation.ValueAnimator.isRunning()' on a null object reference at com.eyalbira.loadingdots.LoadingDots.startAnimationIfAttached(LoadingDots.java:167) at com.eyalbira.loadingdots.LoadingDots.setVisibility(LoadingDots.java:148)

I have LoadingDots_auto_play=false. I checked the code and found the issue here:
private void startAnimationIfAttached() { if (mIsAttachedToWindow && !mAnimation.isRunning()) { mAnimation.start(); } }

It seems that mAnimation is null when autoplay is false. You've added check whether mAnimation is null anywhere you are invoking methods on it but here :)

@intmainreturn00
Copy link

can reproduce exactly the same crash.

@nicholas-gs
Copy link

I am having the exact same problem. I worked around by just having autoplay as true and working with .setVisibility().

@ahermayur
Copy link

i am also getting similer kind of crash

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.animation.ValueAnimator.isRunning()' on a null object reference
at com.eyalbira.loadingdots.LoadingDots.startAnimationIfAttached(LoadingDots.java:167)
at com.eyalbira.loadingdots.LoadingDots.setVisibility(LoadingDots.java:148)
at com.myapp.fragment.StreamFragment.startLoadingStreamOverMobileData(StreamFragment.java:1241)
at com.myapp.fragment.StreamFragment.onCheckedChanged(StreamFragment.java:1176)
at android.widget.CompoundButton.setChecked(CompoundButton.java:171)
at android.widget.ToggleButton.setChecked(ToggleButton.java:71)
at android.widget.CompoundButton.toggle(CompoundButton.java:127)
at android.widget.CompoundButton.performClick(CompoundButton.java:132)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6680)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants