我具有以下功能,用于监听acclerometer和magnetometer的值: public float[] mGravity =// do things if you're interested in accuracy changes
public void onSensorChanged// do things if you're i
我需要在另一种方法中使用传感器的值。我不知道如何从onSensorChanged()方法中获取值。我尝试创建一个全局字段,在这个字段中写入传感器值,但是在onSensorChanged()方法之外,字段为null。我已经在textView in onSensorChanged()事件中显示了传感器值,它在这里工作。显示的值不为空。当我尝试
我正在尝试使用Sensor.Type_Light或光传感器来检测event.values中的变化。@Override if (event.sensor.getType()== Sensor.TYPE_LIGHT+event.values[0]);如您所见,这些值显示在一个TextView中。此外,我们知道如果event.values为0,则没有灯光,并且随着灯光