Ketai Accelerometer Sensor in Sketch in Java mode.

Hi,

I'm working on a project for android which uses the Ketai.sensors library, specifically the accelerometer. Everything runs fine in Android Mode on the device. When i want to run the sketch in Java Mode on Windows, I get the following error:

NoClassDefFoundError: android/hardware/SensorEventListener

On the line:

  sensor = new KetaiSensor(this);
  sensor.start();

Is there any way I can tell processing to ignore the sensor stuff if there is no accelerometer present while running in Java Mode on windows?

Answers

  • I've figured it out. Using a try-catch block.

      try
      {
      sensor = new KetaiSensor(this);
      sensor.start();
      println(sensor.list());
      }
      catch(NoClassDefFoundError e)
      {
        println("No Accelerometer Present");
      }
    
Sign In or Register to comment.