Code example for Sensor

Methods: getMaximumRange, getMinDelay, getName, getPower, getResolution, getType, getVendor, getVersion

0
			y = se.values[SensorManager.DATA_Y]; 
			z = se.values[SensorManager.DATA_Z]; 
 
			// 设置显示文字 
			textView_sensor.setText("距离感应:" + "\n" + "x=" + x + "\n" + "y=" + y 
					+ "\n" + "z=" + z + "\n\n" + "Name:" + sensor.getName() 
					+ "\n" + "Type:" + sensor.getType() + "\n" + "Version:" 
					+ sensor.getVersion() + "\n" + "vendor:" 
					+ sensor.getVendor() + "\n" + "MAXrange:" 
					+ sensor.getMaximumRange() + "\n" + "MinDelay:" 
					+ sensor.getMinDelay() + "\n" + "power:" 
					+ sensor.getPower() 
					// getMinDelay()Added in API level 9 
					+ "\n" + "Resolution:" + sensor.getResolution() + "\n"); 
 
			if (x == 0) { 
				textView_sensor.setBackgroundColor(0xff000000);// 设背景颜色为黑 
			} else if (x == 1) { 
				textView_sensor.setBackgroundColor(0xff0000ff);// 设背景颜色为蓝 
			} else { 
				return;