Code example for Sensor

Methods: getType

0
 
        return listName;
    } 
     
    public static void setSensor(final Sensor sensor) {
        switch (sensor.getType()) {
            case Sensor.TYPE_ACCELEROMETER:
                SensorItem.ACCELEROMETER.setSensorInstance(sensor);
                break; 
            case Sensor.TYPE_MAGNETIC_FIELD:
                SensorItem.MAGNETIC_FIELD.setSensorInstance(sensor);
                break; 
            case Sensor.TYPE_ORIENTATION:
                SensorItem.ORIENTATION.setSensorInstance(sensor);
                break; 
            case Sensor.TYPE_PROXIMITY:
                SensorItem.PROXIMITY.setSensorInstance(sensor);
                break; 
            case Sensor.TYPE_LIGHT:
                SensorItem.LIGHT.setSensorInstance(sensor);
                break;