diff options
| author | 2016-03-02 17:15:51 +0000 | |
|---|---|---|
| committer | 2016-03-02 17:15:52 +0000 | |
| commit | 949b9ff1b13b838bacee694517593acaf393869c (patch) | |
| tree | 11cdf181e2c5420a1fea9e56c2ddae69995072af | |
| parent | 98e386f650d5f6d05792d164e78ff3cbdbc5381e (diff) | |
| parent | 027e3fbd5ec661052490ece0359f543f97c24e10 (diff) | |
Merge "docs: Mild fix to a sensors_overview code example" into nyc-dev
| -rw-r--r-- | docs/html/guide/topics/sensors/sensors_overview.jd | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/html/guide/topics/sensors/sensors_overview.jd b/docs/html/guide/topics/sensors/sensors_overview.jd index 0b3cb2b1cd48..53faca0a911a 100644 --- a/docs/html/guide/topics/sensors/sensors_overview.jd +++ b/docs/html/guide/topics/sensors/sensors_overview.jd @@ -465,6 +465,7 @@ private Sensor mSensor; ... mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); +mSensor = null; if (mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) != null){ List<Sensor> gravSensors = mSensorManager.getSensorList(Sensor.TYPE_GRAVITY); @@ -476,7 +477,7 @@ if (mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) != null){ } } } -else{ +if (mSensor == null){ // Use the accelerometer. if (mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null){ mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); |