是否可以只显示sensor name
和vendor
来自这个?
public class SensorikTestActivity extends Activity {
private ListView listView;
private SensorManager mSensorManager;
private List<Sensor> deviceSensors = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
listView = ((ListView) findViewById(R.id.listView1));
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
deviceSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
listView.setAdapter(new ArrayAdapter<Sensor>(this,
android.R.layout.simple_list_item_1, deviceSensors));
}
}
实际上它显示了传感器的所有信息,但我只需要一些信息。谢谢