There is a bug, a nullpointerException was thrown out, and the app kept running.

edited April 2017 in Android Mode

Can anyone help me to find out where is the problem? I programmed a liveWallpaper, and I rotated the screen on the "set wallpaper" interface (this is a tablet with a big screen size). And the live wallpaper restarted, and sometimes the app crashed(not always) with a nullPointerException. The LiveWallpaper kept running on the background.

E/AndroidRuntime: FATAL EXCEPTION: Animation Thread
           Process: tianranwang.livewallpaper, PID: 8381
           java.lang.NullPointerException: Attempt to invoke interface method 'void android.view.SurfaceHolder.unlockCanvasAndPost(android.graphics.Canvas)' on a null object reference
           at processing.a2d.PGraphicsAndroid2D.endDraw(Unknown Source)
           at processing.core.PApplet.handleDraw(Unknown Source)
           at processing.core.PSurfaceNone.callDraw(Unknown Source)
           at processing.core.PSurfaceNone$AnimationThread.run(Unknown Source)

Answers

  • @TrW236=== have you choosen an orientation for your livewallpaper?

    if no you have to manage by yourself configChanges().

Sign In or Register to comment.