Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Sensor example not working #6

@phanirithvij

Description

@phanirithvij

I've made a sketch following the sensor example from the docs

The app crashed when used as a live wallpaper but it works when used as a regular app.

The error was

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
 at processing.test.test_android_sketch.test_android_sketch.setup(test_android_sketch.java:55)
 at processing.core.PApplet.handleDraw(PApplet.java:1838)
 at processing.opengl.PSurfaceGLES$RendererGLES.onDrawFrame(PSurfaceGLES.java:264)
 at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1553)
 at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1253)

The 55th line it mentions is

void setup(){
  ...
  manager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
  ...
}

The app works normally. But the live wallpaper doesn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions