get Sensor Chart Max X - Android Hardware

Android examples for Hardware:Sensor

Description

get Sensor Chart Max X

Demo Code


//package com.java2s;

import android.hardware.Sensor;

public class Main {
    @SuppressWarnings("deprecation")
    static public double getSensorChartMaxX(Sensor sensor) {
        double xMax;
        switch (sensor.getType()) {
        case Sensor.TYPE_LIGHT:
        case Sensor.TYPE_PRESSURE:
        case Sensor.TYPE_PROXIMITY:
        case Sensor.TYPE_TEMPERATURE:
            xMax = 50;/*from  w w  w  . j  a  v  a2  s  . c o  m*/
            break;
        default:
            xMax = 2000;
            break;
        }

        return xMax;
    }
}

Related Tutorials