get Sensor Chart Max Y - Android Hardware

Android examples for Hardware:Sensor

Description

get Sensor Chart Max Y

Demo Code


//package com.java2s;

import android.hardware.Sensor;

public class Main {
    @SuppressWarnings("deprecation")
    static public double getSensorChartMaxY(Sensor sensor) {
        double yMax;
        switch (sensor.getType()) {
        case Sensor.TYPE_ACCELEROMETER:
            yMax = 20.0;/* w  w  w.j a  v a 2  s  .c o m*/
            break;
        case Sensor.TYPE_GYROSCOPE:
            yMax = 40.0;
            break;
        case Sensor.TYPE_LIGHT:
            yMax = 240.0;
            break;
        case Sensor.TYPE_MAGNETIC_FIELD:
            yMax = 30.0;
            break;
        case Sensor.TYPE_ORIENTATION:
            yMax = 150.0;
            break;
        case Sensor.TYPE_PROXIMITY:
            yMax = 15.0;
            break;
        case Sensor.TYPE_TEMPERATURE:
            yMax = 40.0;
            break;
        case Sensor.TYPE_LINEAR_ACCELERATION:
            yMax = 30.0;
            break;
        case Sensor.TYPE_GRAVITY:
            yMax = 10.0;
            break;
        case Sensor.TYPE_ROTATION_VECTOR:
            yMax = 5.0;
            break;
        default:
            yMax = 50.0;
            break;
        }

        return yMax;
    }
}

Related Tutorials