Example usage for android.hardware Sensor TYPE_LIGHT

List of usage examples for android.hardware Sensor TYPE_LIGHT

Introduction

In this page you can find the example usage for android.hardware Sensor TYPE_LIGHT.

Prototype

int TYPE_LIGHT

To view the source code for android.hardware Sensor TYPE_LIGHT.

Click Source Link

Document

A constant describing a light sensor type.

Usage

From source file:com.vonglasow.michael.satstat.SensorSectionFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mainActivity = (MainActivity) this.getContext();
    View rootView = inflater.inflate(R.layout.fragment_main_sensors, container, false);

    Sensor mAccSensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    Sensor mGyroSensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
    Sensor mMagSensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
    Sensor mLightSensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
    Sensor mProximitySensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
    Sensor mPressureSensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE);
    Sensor mHumiditySensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_RELATIVE_HUMIDITY);
    Sensor mTempSensor = mainActivity.sensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);

    mAccSensorRes = getSensorDecimals(mAccSensor, mAccSensorRes);
    mGyroSensorRes = getSensorDecimals(mGyroSensor, mGyroSensorRes);
    mMagSensorRes = getSensorDecimals(mMagSensor, mMagSensorRes);
    mLightSensorRes = getSensorDecimals(mLightSensor, mLightSensorRes);
    mProximitySensorRes = getSensorDecimals(mProximitySensor, mProximitySensorRes);
    mPressureSensorRes = getSensorDecimals(mPressureSensor, mPressureSensorRes);
    mHumiditySensorRes = getSensorDecimals(mHumiditySensor, mHumiditySensorRes);
    mTempSensorRes = getSensorDecimals(mTempSensor, mTempSensorRes);

    // Initialize controls
    accStatus = (TextView) rootView.findViewById(R.id.accStatus);
    accHeader = (TextView) rootView.findViewById(R.id.accHeader);
    accX = (TextView) rootView.findViewById(R.id.accX);
    accY = (TextView) rootView.findViewById(R.id.accY);
    accZ = (TextView) rootView.findViewById(R.id.accZ);
    accTotal = (TextView) rootView.findViewById(R.id.accTotal);
    rotStatus = (TextView) rootView.findViewById(R.id.rotStatus);
    rotHeader = (TextView) rootView.findViewById(R.id.rotHeader);
    rotX = (TextView) rootView.findViewById(R.id.rotX);
    rotY = (TextView) rootView.findViewById(R.id.rotY);
    rotZ = (TextView) rootView.findViewById(R.id.rotZ);
    rotTotal = (TextView) rootView.findViewById(R.id.rotTotal);
    magStatus = (TextView) rootView.findViewById(R.id.magStatus);
    magHeader = (TextView) rootView.findViewById(R.id.magHeader);
    magX = (TextView) rootView.findViewById(R.id.magX);
    magY = (TextView) rootView.findViewById(R.id.magY);
    magZ = (TextView) rootView.findViewById(R.id.magZ);
    magTotal = (TextView) rootView.findViewById(R.id.magTotal);
    orStatus = (TextView) rootView.findViewById(R.id.orStatus);
    orHeader = (TextView) rootView.findViewById(R.id.orHeader);
    orAzimuth = (TextView) rootView.findViewById(R.id.orAzimuth);
    orAziText = (TextView) rootView.findViewById(R.id.orAziText);
    orPitch = (TextView) rootView.findViewById(R.id.orPitch);
    orRoll = (TextView) rootView.findViewById(R.id.orRoll);
    miscHeader = (TextView) rootView.findViewById(R.id.miscHeader);
    tempStatus = (TextView) rootView.findViewById(R.id.tempStatus);
    tempHeader = (TextView) rootView.findViewById(R.id.tempHeader);
    metTemp = (TextView) rootView.findViewById(R.id.metTemp);
    pressureStatus = (TextView) rootView.findViewById(R.id.pressureStatus);
    pressureHeader = (TextView) rootView.findViewById(R.id.pressureHeader);
    metPressure = (TextView) rootView.findViewById(R.id.metPressure);
    humidStatus = (TextView) rootView.findViewById(R.id.humidStatus);
    humidHeader = (TextView) rootView.findViewById(R.id.humidHeader);
    metHumid = (TextView) rootView.findViewById(R.id.metHumid);
    lightStatus = (TextView) rootView.findViewById(R.id.lightStatus);
    lightHeader = (TextView) rootView.findViewById(R.id.lightHeader);
    light = (TextView) rootView.findViewById(R.id.light);
    proximityStatus = (TextView) rootView.findViewById(R.id.proximityStatus);
    proximityHeader = (TextView) rootView.findViewById(R.id.proximityHeader);
    proximity = (TextView) rootView.findViewById(R.id.proximity);

    mainActivity.sensorSectionFragment = this;

    return rootView;
}

From source file:uk.ac.horizon.ubihelper.service.Service.java

@Override
public void onCreate() {
    // One-time set-up...
    Log.d(TAG, "onCreate()");
    // TODO/*from  w  ww .  j  av a2 s.  c om*/
    super.onCreate();
    // handler for requests
    mHandler = new Handler();
    // create taskbar notification
    int icon = R.drawable.service_notification_icon;
    CharSequence tickerText = getText(R.string.notification_start_message);
    long when = System.currentTimeMillis();

    Notification notification = new Notification(icon, tickerText, when);

    Context context = this;
    CharSequence contentTitle = getText(R.string.notification_title);
    CharSequence contentText = getText(R.string.notification_description);
    Intent notificationIntent = new Intent(this, MainPreferences.class);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

    startForeground(RUNNING_ID, notification);

    channelManager = new ChannelManager(peerChannelFactory);
    // sensors
    if (!isEmulator()) {
        Log.d(TAG, "Create sensor channels...");

        SensorChannel magnetic = new SensorChannel("magnetic", this, Sensor.TYPE_MAGNETIC_FIELD);
        channelManager.addChannel(magnetic);
        SensorChannel accelerometer = new SensorChannel("accelerometer", this, Sensor.TYPE_ACCELEROMETER);
        channelManager.addChannel(accelerometer);
        SensorChannel gyro = new SensorChannel("gyro", this, Sensor.TYPE_GYROSCOPE);
        channelManager.addChannel(gyro);
        SensorChannel light = new SensorChannel("light", this, Sensor.TYPE_LIGHT);
        channelManager.addChannel(light);
        SensorChannel pressure = new SensorChannel("pressure", this, Sensor.TYPE_PRESSURE);
        channelManager.addChannel(pressure);
        SensorChannel proximity = new SensorChannel("proximity", this, Sensor.TYPE_PROXIMITY);
        channelManager.addChannel(proximity);
        SensorChannel temperature = new SensorChannel("temperature", this, Sensor.TYPE_TEMPERATURE);
        channelManager.addChannel(temperature);

        try {
            Field f = Sensor.class.getField("TYPE_AMBIENT_TEMPERATURE");
            SensorChannel sc = new SensorChannel("ambientTemperature", this, f.getInt(null));
            channelManager.addChannel(sc);
        } catch (Exception e) {
            Log.d(TAG, "Could not get field Sensor.TYPE_AMBIENT_TEMPERATURE");
        }
        try {
            Field f = Sensor.class.getField("TYPE_RELATIVE_HUMIDITY");
            SensorChannel sc = new SensorChannel("relativeHumidity", this, f.getInt(null));
            channelManager.addChannel(sc);
        } catch (Exception e) {
            Log.d(TAG, "Could not get field Sensor.TYPE_AMBIENT_TEMPERATURE");
        }

        // all sensors by full name
        SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
        if (sensorManager != null) {
            List<Sensor> sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
            for (Sensor sensor : sensors) {
                SensorChannel sc = new SensorChannel("sensor." + sensor.getName(), this, sensor);
                channelManager.addChannel(sc);
            }
        }
        BluetoothDiscoveryChannel btchannel = new BluetoothDiscoveryChannel(this, mHandler, "bluetooth");
        channelManager.addChannel(btchannel);
        WifiScannerChannel wifichannel = new WifiScannerChannel(this, mHandler, "wifi");
        channelManager.addChannel(wifichannel);
        GpsStatusChannel gpsstatus = new GpsStatusChannel("gpsstatus", this);
        channelManager.addChannel(gpsstatus);
        CellLocationChannel cellchannel = new CellLocationChannel(mHandler, this, "cell.location", false);
        channelManager.addChannel(cellchannel);
        CellLocationChannel cellchannel2 = new CellLocationChannel(mHandler, this, "cell.neighbors", true);
        channelManager.addChannel(cellchannel2);
        CellStrengthChannel cellchannel3 = new CellStrengthChannel(this, "cell.strength");
        channelManager.addChannel(cellchannel3);
    }
    channelManager.addChannel(new TimeChannel(mHandler, "time"));
    List<String> locationProviders = LocationChannel.getAllProviders(this);
    for (String provider : locationProviders) {
        LocationChannel locchannel = new LocationChannel("location." + provider, this, provider);
        channelManager.addChannel(locchannel);
    }

    channelManager.addChannel(new MicChannel(mHandler, "mic"));

    Log.d(TAG, "Create http server...");

    // http server
    httpPort = getPort();

    httpListener = new HttpListener(this, httpPort);
    httpListener.start();

    // peer communication
    peerManager = new PeerManager(this);
    int serverPort = peerManager.getServerPort();

    channelManager.addChannel(new EnabledPeersChannel(this, peerManager, "peers"));

    // wifi discovery
    wifiDiscoveryManager = new WifiDiscoveryManager(this);
    wifiDiscoverable = getWifiDiscoverable();
    wifiDiscoveryManager.setServerPort(serverPort);
    wifiDiscoveryManager.setEnabled(wifiDiscoverable);

    bluetooth = BluetoothAdapter.getDefaultAdapter();
    if (bluetooth != null)
        btmac = bluetooth.getAddress();

    telephony = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    if (telephony != null)
        imei = telephony.getDeviceId();

    logManager = new LogManager(this, channelManager);
    logManager.checkPreferences();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(onRunChangeListener);

    Log.d(TAG, "onCreate() finished");
}

From source file:com.microsoft.mimickeralarm.mimics.MimicWithCameraFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_camera_mimic, container, false);

    SurfaceView previewView = (SurfaceView) view.findViewById(R.id.camera_preview_view);

    Display display = getActivity().getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);/*from   ww  w .j a va  2  s .c  o m*/
    mSize = size;
    double aspectRatio = size.y > size.x ? (double) size.y / (double) size.x
            : (double) size.x / (double) size.y;
    mCameraPreview = new CameraPreview(previewView, aspectRatio, CameraFacing);

    View overlay = view.findViewById(R.id.camera_preview_overlay);
    overlay.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                // Camera sensor ranges from -1000 to 1000 regardless of aspect ratio, sizes, resolution, ...
                int deltaX = (int) (((float) mSize.x - event.getX()) / mSize.x * -2000) + 1000;
                int deltaY = (int) (((float) mSize.y - event.getY()) / mSize.y * -2000) + 1000;
                mCameraPreview.onFocus(deltaX, deltaY);
            }
            return true;
        }
    });

    ProgressButton progressButton = (ProgressButton) view.findViewById(R.id.capture_button);
    progressButton.setReadyState(ProgressButton.State.ReadyCamera);

    mStateManager = new MimicStateManager();
    mStateManager.registerCountDownTimer((CountDownTimerView) view.findViewById(R.id.countdown_timer),
            TIMEOUT_MILLISECONDS);
    mStateManager.registerStateBanner((MimicStateBanner) view.findViewById(R.id.mimic_state));
    mStateManager.registerProgressButton(progressButton, MimicButtonBehavior.CAMERA);
    mStateManager.registerMimic(this);

    mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
    if (mSensorManager != null) {
        mLightSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
    }
    mLightSensorListener = new SensorEventListener() {
        @Override
        public void onSensorChanged(SensorEvent event) {
            if (event.values[0] < LIGHT_THRESHOLD && CameraFacing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
                mTooDarkToast.show();
            } else {
                mTooDarkToast.cancel();
            }
        }

        @Override
        public void onAccuracyChanged(Sensor sensor, int accuracy) {
        }
    };
    // This toast is only shown when there is not enough light
    mTooDarkToast = Toast.makeText(getActivity(), getString(R.string.mimic_camera_too_dark),
            Toast.LENGTH_SHORT);

    return view;
}

From source file:cn.edu.gdmec.t00385.lightsensor.LightSensorListener.java

/**
 * Start listening for compass sensor./* w  w w .  ja v a  2 s.co m*/
 *
 * @return          status of listener
 */
public int start() {

    // If already starting or running, then just return
    if ((this.status == LightSensorListener.RUNNING) || (this.status == LightSensorListener.STARTING)) {
        return this.status;
    }

    // Get compass sensor from sensor manager
    @SuppressWarnings("deprecation")
    List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_LIGHT);

    // If found, then register as listener
    if (list != null && list.size() > 0) {
        this.mSensor = list.get(0);
        this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
        this.lastAccessTime = System.currentTimeMillis();
        this.setStatus(LightSensorListener.STARTING);
    }

    // If error, then set status to error
    else {
        this.setStatus(LightSensorListener.ERROR_FAILED_TO_START);
    }

    return this.status;
}

From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.fragments.GraphPlotFragment.java

private void updateTitleAndType() {

    ArrayList<String> grpTitle = new ArrayList<String>();
    ArrayList<Integer> grpType = new ArrayList<Integer>();
    ArrayList<Boolean> grpBarType = new ArrayList<Boolean>();

    SharedPreferences pref = PreferenceManager
            .getDefaultSharedPreferences(getActivity().getApplicationContext());

    if (pref.getBoolean(getResources().getString(R.string.in_hum), false)) {
        grpTitle.add("Humidity");
        grpType.add(Sensor.TYPE_RELATIVE_HUMIDITY);
        grpBarType.add(false);/*from  ww  w .j  a va 2 s  .co m*/

    }
    if (pref.getBoolean(getResources().getString(R.string.in_lig), false)) {
        grpTitle.add("Light in lux/min");
        grpType.add(Sensor.TYPE_LIGHT);
        grpBarType.add(false);

    }
    if (pref.getBoolean(getResources().getString(R.string.in_pres), false)) {
        grpTitle.add("Pressure in min");
        grpType.add(Sensor.TYPE_PRESSURE);
        grpBarType.add(false);

    }
    if (pref.getBoolean(getResources().getString(R.string.in_prox), false)) {
        grpTitle.add("Proximity in min");
        grpType.add(Sensor.TYPE_PROXIMITY);
        grpBarType.add(false);

    }
    if (pref.getBoolean(getResources().getString(R.string.in_tem), false)) {
        grpTitle.add("Ambient Temperature in C");
        grpType.add(Sensor.TYPE_AMBIENT_TEMPERATURE);
        grpBarType.add(false);

    }
    if (pref.getBoolean(getResources().getString(R.string.pulse), false)) {
        grpTitle.add("Heart Rate bpm");
        grpType.add(999);
        grpBarType.add(false);

    }
    if (pref.getBoolean(getResources().getString(R.string.in_acc), false)) {
        grpTitle.add("Motion Strength/min");
        grpType.add(Sensor.TYPE_ACCELEROMETER);
        grpBarType.add(true);

    }
    if (pref.getBoolean(getResources().getString(R.string.in_mag), false)) {
        grpTitle.add("Magnetic Field Strength/min");
        grpType.add(Sensor.TYPE_MAGNETIC_FIELD);
        grpBarType.add(true);

    }
    if (pref.getBoolean(getResources().getString(R.string.in_grav), false)) {
        grpTitle.add("Gravity Strength/min");
        grpType.add(Sensor.TYPE_GRAVITY);
        grpBarType.add(true);

    }

    if (pref.getBoolean(getResources().getString(R.string.in_gyrs), false)) {
        grpTitle.add("Gyroscope Strength/min");
        grpType.add(Sensor.TYPE_GYROSCOPE);
        grpBarType.add(true);

    }
    if (pref.getBoolean(getResources().getString(R.string.in_lin_acc), false)) {
        grpTitle.add("Linear Accelerometer Strength/min");
        grpType.add(Sensor.TYPE_LINEAR_ACCELERATION);
        grpBarType.add(true);

    }
    if (grpTitle.size() == 2 && grpType.size() == 2) {
        firstGrpTitle = grpTitle.get(0);
        firstGrpType = grpType.get(0);
        isFirstBar = grpBarType.get(0);

        secondGrpTitle = grpTitle.get(1);
        secondGrpType = grpType.get(1);
        isSecondBar = grpBarType.get(1);
    } else if (grpTitle.size() == 1 && grpType.size() == 1) {
        firstGrpTitle = grpTitle.get(0);
        firstGrpType = grpType.get(0);
        isFirstBar = grpBarType.get(0);

        secondGrpTitle = "";
        secondGrpType = -1;
    }
}

From source file:foam.starwisp.StarwispActivity.java

protected void DeclareSensors() {
    String str = "";
    str += "(define sensor-accelerometer " + Sensor.TYPE_ACCELEROMETER + ")";
    str += "(define sensor-ambient-temperature " + Sensor.TYPE_AMBIENT_TEMPERATURE + ")";
    str += "(define sensor-game-rotation-vector " + Sensor.TYPE_GAME_ROTATION_VECTOR + ")";
    str += "(define sensor-geomagnetic-rotation-vector " + Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR + ")";
    str += "(define sensor-gravity " + Sensor.TYPE_GRAVITY + ")";
    str += "(define sensor-gyroscope " + Sensor.TYPE_GYROSCOPE + ")";
    str += "(define sensor-gyroscope-uncalibrated " + Sensor.TYPE_GYROSCOPE_UNCALIBRATED + ")";
    str += "(define sensor-heart-rate " + Sensor.TYPE_HEART_RATE + ")";
    str += "(define sensor-light " + Sensor.TYPE_LIGHT + ")";
    str += "(define sensor-linear-acceleration " + Sensor.TYPE_LINEAR_ACCELERATION + ")";
    str += "(define sensor-magnetic-field " + Sensor.TYPE_MAGNETIC_FIELD + ")";
    str += "(define sensor-magnetic-field-uncalibrated " + Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED + ")";
    str += "(define sensor-orientation " + Sensor.TYPE_ORIENTATION + ")";
    str += "(define sensor-pressure " + Sensor.TYPE_PRESSURE + ")";
    str += "(define sensor-proximity " + Sensor.TYPE_PROXIMITY + ")";
    str += "(define sensor-relative-humidity " + Sensor.TYPE_RELATIVE_HUMIDITY + ")";
    str += "(define sensor-rotation-vector " + Sensor.TYPE_ROTATION_VECTOR + ")";
    str += "(define sensor-significant-motion " + Sensor.TYPE_SIGNIFICANT_MOTION + ")";
    str += "(define sensor-step-counter " + Sensor.TYPE_STEP_COUNTER + ")";
    str += "(define sensor-step-detector " + Sensor.TYPE_STEP_DETECTOR + ")";
    m_Scheme.eval(str);/* w  ww.  j  av  a  2 s. c  om*/
}

From source file:org.apache.cordova.devicemotion.LightListener.java

/**
 * Called when the accuracy of the sensor has changed.
 *
 * @param sensor/*  ww w .j a  va  2s.  c o  m*/
 * @param accuracy
 */
public void onAccuracyChanged(Sensor sensor, int accuracy) {
    // Only look at accelerometer events
    if (sensor.getType() != Sensor.TYPE_LIGHT) {
        return;
    }

    // If not running, then just return
    if (this.status == LightListener.STOPPED) {
        return;
    }
    this.accuracy = accuracy;
}

From source file:edu.uwp.alga.calculator.CalculatorFragment.java

public void getLux() {
    sensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
    lightSensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);

    if (lightSensor == null) {
        lux = 12000f;/* w  w w  .  j  a  v  a  2  s .  c o  m*/
        Log.e("Light", String.valueOf(lux));
    } else {
        sensorManager.registerListener(this, lightSensor, SensorManager.SENSOR_DELAY_NORMAL);
    }

}

From source file:org.apache.cordova.devicemotion.LightListener.java

/**
 * Sensor listener event.//  w  w  w.  j av  a  2  s . c o m
 *
 * @param SensorEvent event
 */
public void onSensorChanged(SensorEvent event) {
    // Only look at accelerometer events
    if (event.sensor.getType() != Sensor.TYPE_LIGHT) {
        return;
    }

    // If not running, then just return
    if (this.status == LightListener.STOPPED) {
        return;
    }
    this.setStatus(LightListener.RUNNING);

    if (this.accuracy >= SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM) {

        // Save time that event was received
        this.timestamp = System.currentTimeMillis();
        this.x = event.values[0];

        this.win();
    }
}

From source file:it.unime.mobility4ckan.MainActivity.java

private void createListView() {

    overviewList.clear();//from  ww w  .j  a v  a  2s .  c  o  m

    Overview overviewTitle = new Overview(getApplicationContext());
    overviewTitle.setSensorName("Nome Sensore");
    overviewTitle.setCurrentValue("Valore Corrente");
    overviewTitle.setValueSend("Valore Inviato");
    overviewList.add(overviewTitle);

    Overview overview0 = new Overview(getApplicationContext());
    overview0.setSensorName("Speed");
    overview0.setCurrentValue("" + mySensor.getCurrentSpeed());
    overview0.setValueSend(lastSpeedValue);
    overviewList.add(overview0);

    for (int k = 0; k < sensorList.size(); k++) {
        Overview overview = new Overview(getApplicationContext());
        switch (sensorList.get(k).getType()) {
        case Sensor.TYPE_AMBIENT_TEMPERATURE: // Gradi Celsius (C)
            overview.setSensorName("Temperature");
            overview.setCurrentValue("" + mySensor.getCurrentTemp());
            overview.setValueSend(lastTempValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_PRESSURE:
            overview.setSensorName("Pressure");
            overview.setCurrentValue("" + mySensor.getCurrentPressure());
            overview.setValueSend(lastPressureValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_LIGHT: // lx
            overview.setSensorName("Light");
            overview.setCurrentValue("" + mySensor.getCurrentLight());
            overview.setValueSend(lastLightValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_ACCELEROMETER: // m/s2
            overview.setSensorName("Accelerometer");
            overview.setCurrentValue("" + mySensor.getCurrentAcceleration());
            overview.setValueSend(lastAccelerationValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_GYROSCOPE: // rad/s
            overview.setSensorName("Gyroscope");
            overview.setCurrentValue("" + mySensor.getCurrentGyroscope());
            overview.setValueSend(lastGyroscopeValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_MAGNETIC_FIELD: // T
            overview.setSensorName("Magnetic Field");
            overview.setCurrentValue("" + mySensor.getCurrentMagnetic());
            overview.setValueSend(lastMagneticValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_PROXIMITY: // cm
            overview.setSensorName("Proximity");
            overview.setCurrentValue("" + mySensor.getCurrentProximity());
            overview.setValueSend(lastProximityValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_ROTATION_VECTOR: // unita di misura sconosciuta
            overview.setSensorName("Rotation Vector");
            overview.setCurrentValue("" + mySensor.getCurrentRotation());
            overview.setValueSend(lastRotationValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_GRAVITY: // m/s2
            overview.setSensorName("Gravity");
            overview.setCurrentValue("" + mySensor.getCurrentGravity());
            overview.setValueSend(lastGravityValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_LINEAR_ACCELERATION: // m/s2
            overview.setSensorName("Linear Acceleration");
            overview.setCurrentValue("" + mySensor.getCurrentLinearAcceleration());
            overview.setValueSend(lastLinearAccelerationValue);
            overviewList.add(overview);
            break;

        case Sensor.TYPE_RELATIVE_HUMIDITY: // %
            overview.setSensorName("Relative Humidity");
            overview.setCurrentValue("" + mySensor.getCurrentHumidity());
            overview.setValueSend(lastRelativeHumidity);
            overviewList.add(overview);
            break;

        default:
            break;
        }
    }

    listView.setAdapter(new OverviewAdapter(getApplicationContext(), overviewList));

}