get Sensor Chart Min Y - Android Hardware

Android examples for Hardware:Sensor

Description

get Sensor Chart Min Y

Demo Code


//package com.java2s;

import android.hardware.Sensor;

public class Main {
    @SuppressWarnings("deprecation")
    static public double getSensorChartMinY(Sensor sensor) {
        double yMin;
        switch (sensor.getType()) {
        case Sensor.TYPE_ACCELEROMETER:
            yMin = -20.0;//from w  ww. ja  v a2  s  . c om
            break;
        case Sensor.TYPE_GYROSCOPE:
            yMin = -40.0;
            break;
        case Sensor.TYPE_MAGNETIC_FIELD:
            yMin = -30.0;
            break;
        case Sensor.TYPE_ORIENTATION:
            yMin = -50.0;
            break;
        case Sensor.TYPE_TEMPERATURE:
            yMin = -40.0;
            break;
        case Sensor.TYPE_LINEAR_ACCELERATION:
            yMin = -30.0;
            break;
        case Sensor.TYPE_GRAVITY:
            yMin = -10.0;
            break;
        case Sensor.TYPE_ROTATION_VECTOR:
            yMin = -5.0;
            break;
        default:
            yMin = 0.0;
            break;
        }

        return yMin;
    }
}

Related Tutorials