igalata / Bubble-Picker

An easy-to-use animation which can be used for content picking for Android
https://medium.com/@igalata13/how-to-create-a-bubble-selection-animation-on-android-627044da4854#.js8nebsx6
1.4k stars 248 forks source link

NullPointer Issue while device is rotated #3

Closed thatsankur closed 7 years ago

thatsankur commented 7 years ago

When device is rotated it causes Null pointer exception in this lib

03-13 18:20:41.611 17885-18474/? E/AndroidRuntime: FATAL EXCEPTION: GLThread 26500 Process: com.hyperbolicdevs.opendictionary, PID: 17885 java.lang.NullPointerException: Attempt to invoke virtual method 'org.jbox2d.dynamics.Fixture org.jbox2d.dynamics.Body.createFixture(org.jbox2d.dynamics.FixtureDef)' on a null object reference at com.igalata.bubblepicker.physics.CircleBody.(CircleBody.kt:61) at com.igalata.bubblepicker.physics.Engine.build(Engine.kt:45) at com.igalata.bubblepicker.rendering.PickerRenderer.initialize(PickerRenderer.kt:73) at com.igalata.bubblepicker.rendering.PickerRenderer.onSurfaceChanged(PickerRenderer.kt:62) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

igalata commented 7 years ago

Hello, @thatsankur Can't reproduce this crash, but I've found the condition when it could be reproduced. Sometimes the World instance can be locked, so it's impossible to create the bodies. Now it's ok. Please review the v0.1.2 version of the library. Also I'd like to mention that the animation is not well-adapted for the landscape orientation. On the phones there is no enough space for the bubbles vertically, so it doesn't look handy for user. Now I'm thinking on how to make it look better. Thanks for your attention to the library :)

thatsankur commented 7 years ago

@igalata It's great lib and well suited for my requirement ! Thanks for it but the issue is it is in kotlin and I don't have enough time to dig deeper into this (phew!) let me see the change if works I will update you Thanks for quick response :)

igalata commented 7 years ago

@thatsankur Yep, I'm highly motivated to improve this library. Thanks for help on that way :)