java.lang.NullPointerException

Appcelerator JIRA | Arthur Evans | 5 years ago
  1. 0

    When running the following code, the animation occurs correctly the first time I click on the view--the green box spins around once, then stops. (If run in a lightweight window, at the finish of the animation, there's a visual anomaly where part of the underlying window shows through. But this is not the bug in question.) The second time I click on the view, the app crashes immediately. Stack trace included below code. {code} var win1 = Ti.UI.createWindow({ backgroundColor : "white" }); var view = Ti.UI.createView({ height : 100, width : 100, backgroundColor : "green" }); win1.add(view); win1.open(); var matrix = Ti.UI.create2DMatrix(); var matrix1 = matrix.rotate(120); var matrix2 = matrix.rotate(240); var transforms = [matrix, matrix1, matrix2]; // We start at 0, so the first rotation is to 120 degrees var nextTransform = 1; animation = Ti.UI.createAnimation({ transform : transforms[nextTransform], duration : 500, }); // On iOS, override the default easing to avoid // jerky transitions between animations. if (Ti.Platform.name === 'iPhone OS') { animation.curve = Ti.UI.iOS.ANIMATION_CURVE_LINEAR; } animation.addEventListener('complete', function(e) { // view.transform = transforms[nextTransform]; if(nextTransform == 0) { // Rotation complete, reset for next time nextTransform = 1; animation.transform = transforms[nextTransform]; } else { // Rotate to the next position nextTransform = (nextTransform + 1) % 3; animation.transform = transforms[nextTransform]; view.animate(animation); } }); view.addEventListener('click', function(e) { view.animate(animation); }); {code} Stack trace: {code} E/AndroidRuntime( 421): FATAL EXCEPTION: main E/AndroidRuntime( 421): java.lang.NullPointerException E/AndroidRuntime( 421): at org.appcelerator.titanium.view.Ti2DMatrix.interpolate(Ti2DMatrix.java:187) E/AndroidRuntime( 421): at org.appcelerator.titanium.util.TiAnimationBuilder$TiMatrixAnimation.applyTransformation(TiAnimationBuilder.java:416) E/AndroidRuntime( 421): at android.view.animation.AnimationSet.initializeInvalidateRegion(AnimationSet.java:286) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1498) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.View.draw(View.java:6743) E/AndroidRuntime( 421): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1640) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.View.draw(View.java:6743) E/AndroidRuntime( 421): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime( 421): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842) E/AndroidRuntime( 421): at android.view.ViewRoot.draw(ViewRoot.java:1407) E/AndroidRuntime( 421): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163) E/AndroidRuntime( 421): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727) E/AndroidRuntime( 421): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 421): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 421): at android.app.ActivityThread.main(ActivityThread.java:4627) E/AndroidRuntime( 421): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 421): at java.lang.reflect.Method.invoke(Method.java:521) E/AndroidRuntime( 421): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) E/AndroidRuntime( 421): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) E/AndroidRuntime( 421): at dalvik.system.NativeStart.main(Native Method) {code} I tried to simplify the test case by removing the complete handler, so there's only a single animation: however, for some reason I can't get the animation to run at all in that case.

    Appcelerator JIRA | 5 years ago | Arthur Evans
    java.lang.NullPointerException
  2. 0

    When running the following code, the animation occurs correctly the first time I click on the view--the green box spins around once, then stops. (If run in a lightweight window, at the finish of the animation, there's a visual anomaly where part of the underlying window shows through. But this is not the bug in question.) The second time I click on the view, the app crashes immediately. Stack trace included below code. {code} var win1 = Ti.UI.createWindow({ backgroundColor : "white" }); var view = Ti.UI.createView({ height : 100, width : 100, backgroundColor : "green" }); win1.add(view); win1.open(); var matrix = Ti.UI.create2DMatrix(); var matrix1 = matrix.rotate(120); var matrix2 = matrix.rotate(240); var transforms = [matrix, matrix1, matrix2]; // We start at 0, so the first rotation is to 120 degrees var nextTransform = 1; animation = Ti.UI.createAnimation({ transform : transforms[nextTransform], duration : 500, }); // On iOS, override the default easing to avoid // jerky transitions between animations. if (Ti.Platform.name === 'iPhone OS') { animation.curve = Ti.UI.iOS.ANIMATION_CURVE_LINEAR; } animation.addEventListener('complete', function(e) { // view.transform = transforms[nextTransform]; if(nextTransform == 0) { // Rotation complete, reset for next time nextTransform = 1; animation.transform = transforms[nextTransform]; } else { // Rotate to the next position nextTransform = (nextTransform + 1) % 3; animation.transform = transforms[nextTransform]; view.animate(animation); } }); view.addEventListener('click', function(e) { view.animate(animation); }); {code} Stack trace: {code} E/AndroidRuntime( 421): FATAL EXCEPTION: main E/AndroidRuntime( 421): java.lang.NullPointerException E/AndroidRuntime( 421): at org.appcelerator.titanium.view.Ti2DMatrix.interpolate(Ti2DMatrix.java:187) E/AndroidRuntime( 421): at org.appcelerator.titanium.util.TiAnimationBuilder$TiMatrixAnimation.applyTransformation(TiAnimationBuilder.java:416) E/AndroidRuntime( 421): at android.view.animation.AnimationSet.initializeInvalidateRegion(AnimationSet.java:286) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1498) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.View.draw(View.java:6743) E/AndroidRuntime( 421): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1640) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) E/AndroidRuntime( 421): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) E/AndroidRuntime( 421): at android.view.View.draw(View.java:6743) E/AndroidRuntime( 421): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime( 421): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842) E/AndroidRuntime( 421): at android.view.ViewRoot.draw(ViewRoot.java:1407) E/AndroidRuntime( 421): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163) E/AndroidRuntime( 421): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727) E/AndroidRuntime( 421): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 421): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 421): at android.app.ActivityThread.main(ActivityThread.java:4627) E/AndroidRuntime( 421): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 421): at java.lang.reflect.Method.invoke(Method.java:521) E/AndroidRuntime( 421): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) E/AndroidRuntime( 421): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) E/AndroidRuntime( 421): at dalvik.system.NativeStart.main(Native Method) {code} I tried to simplify the test case by removing the complete handler, so there's only a single animation: however, for some reason I can't get the animation to run at all in that case.

    Appcelerator JIRA | 5 years ago | Arthur Evans
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.appcelerator.titanium.view.Ti2DMatrix.interpolate()
    2. org.appcelerator.titanium
      TiAnimationBuilder$TiMatrixAnimation.applyTransformation
      1. org.appcelerator.titanium.view.Ti2DMatrix.interpolate(Ti2DMatrix.java:187)
      2. org.appcelerator.titanium.util.TiAnimationBuilder$TiMatrixAnimation.applyTransformation(TiAnimationBuilder.java:416)
      2 frames
    3. Android Platform
      FrameLayout.draw
      1. android.view.animation.AnimationSet.initializeInvalidateRegion(AnimationSet.java:286)
      2. android.view.ViewGroup.drawChild(ViewGroup.java:1498)
      3. android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
      4. android.view.ViewGroup.drawChild(ViewGroup.java:1638)
      5. android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
      6. android.view.View.draw(View.java:6743)
      7. android.widget.FrameLayout.draw(FrameLayout.java:352)
      8. android.view.ViewGroup.drawChild(ViewGroup.java:1640)
      9. android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
      10. android.view.ViewGroup.drawChild(ViewGroup.java:1638)
      11. android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
      12. android.view.View.draw(View.java:6743)
      13. android.widget.FrameLayout.draw(FrameLayout.java:352)
      13 frames
    4. Android
      PhoneWindow$DecorView.draw
      1. com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
      1 frame
    5. Android Platform
      ActivityThread.main
      1. android.view.ViewRoot.draw(ViewRoot.java:1407)
      2. android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
      3. android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
      4. android.os.Handler.dispatchMessage(Handler.java:99)
      5. android.os.Looper.loop(Looper.java:123)
      6. android.app.ActivityThread.main(ActivityThread.java:4627)
      6 frames
    6. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invokeNative(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:521)
      2 frames
    7. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      2 frames
    8. Android Platform
      NativeStart.main
      1. dalvik.system.NativeStart.main(Native Method)
      1 frame