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

Fixed NullPointerException when using Slider on Android 2.3.3 #340

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

iamovrhere
Copy link

On a 2.3.3 device an application throws a NullPointerException. The problem does not present itself on a 4.3 test device. Wrapping the ball.invalidate() call in a null check seems to resolve it.

Original trace below:
E/AndroidRuntime( 3827): android.view.InflateException: Binary XML file line #9: Error inflating class com.gc.materialdesign.views.Slider E/AndroidRuntime( 3827): at android.view.LayoutInflater.createView(LayoutInflater.java:518) E/AndroidRuntime( 3827): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) E/AndroidRuntime( 3827): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) E/AndroidRuntime( 3827): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) E/AndroidRuntime( 3827): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) E/AndroidRuntime( 3827): at android.view.ViewStub.inflate(ViewStub.java:232) E/AndroidRuntime( 3827): at android.view.ViewStub.setVisibility(ViewStub.java:213) E/AndroidRuntime( 3827): .... E/AndroidRuntime( 3827): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 3827): at android.os.Looper.loop(Looper.java:130) E/AndroidRuntime( 3827): at android.app.ActivityThread.main(ActivityThread.java:3687) E/AndroidRuntime( 3827): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 3827): at java.lang.reflect.Method.invoke(Method.java:507) E/AndroidRuntime( 3827): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) E/AndroidRuntime( 3827): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) E/AndroidRuntime( 3827): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 3827): Caused by: java.lang.reflect.InvocationTargetException E/AndroidRuntime( 3827): at java.lang.reflect.Constructor.constructNative(Native Method) E/AndroidRuntime( 3827): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) E/AndroidRuntime( 3827): at android.view.LayoutInflater.createView(LayoutInflater.java:505) E/AndroidRuntime( 3827): ... 30 more E/AndroidRuntime( 3827): Caused by: java.lang.NullPointerException E/AndroidRuntime( 3827): at com.gc.materialdesign.views.Slider.invalidate(Slider.java:97) E/AndroidRuntime( 3827): at android.view.View.setBackgroundDrawable(View.java:7626) E/AndroidRuntime( 3827): at android.view.View.<init>(View.java:2160) E/AndroidRuntime( 3827): at android.view.View.<init>(View.java:1899) E/AndroidRuntime( 3827): at android.view.ViewGroup.<init>(ViewGroup.java:286) E/AndroidRuntime( 3827): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173) E/AndroidRuntime( 3827): at com.gc.materialdesign.views.CustomView.<init>(CustomView.java:22) E/AndroidRuntime( 3827): at com.gc.materialdesign.views.Slider.<init>(Slider.java:41) E/AndroidRuntime( 3827): ... 33 more

In version 2.3.3 the Slider throws a
NullPointerException during invalidate. Added
null check to remedy this.
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

Successfully merging this pull request may close these issues.

1 participant