Example usage for android.hardware Sensor toString

List of usage examples for android.hardware Sensor toString

Introduction

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

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.commonsware.android.sensor.monitor.MainActivity.java

@Override
public List<Sensor> getSensorList() {
    List<Sensor> unfiltered = new ArrayList<Sensor>(mgr.getSensorList(Sensor.TYPE_ALL));
    List<Sensor> result = new ArrayList<Sensor>();

    for (Sensor s : unfiltered) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || !isTriggerSensor(s)) {
            result.add(s);//from   w ww .j av  a 2s.  co m
        }
    }

    Collections.sort(result, new Comparator<Sensor>() {
        @Override
        public int compare(final Sensor a, final Sensor b) {
            return (a.toString().compareTo(b.toString()));
        }
    });

    return (result);
}

From source file:alaindc.crowdroid.SensorsIntentService.java

public void onAccuracyChanged(Sensor sensor, int accuracy) {
    // Do something here if sensor accuracy changes.
    Log.d("SENSORS_INTENTSERVICE", sensor.toString());
}