title: Display an Android Sensors List
body: <p>I'm trying to display a list of available sensors but it's like there are not!<br />
  I was thinking that it was because of the emulator, but i tried it on the phone and the result is the same.</p>
  
  <pre><code>private SensorManager mSensorManager;
  TextView mSensorsTot,mSensorAvailables;
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      // Get the texts fields of the layout and setup to invisible
      mSensorsTot   = (TextView) findViewById(R.id.sensoritot);
      mSensorAvailables  = (TextView) findViewById(R.id.sensoridisponibili);
  
      // Get the SensorManager 
      mSensorManager= (SensorManager) getSystemService(SENSOR_SERVICE);
  
      // List of Sensors Available
      List&lt;Sensor&gt; msensorList = mSensorManager.getSensorList(SensorManager.SENSOR_ALL);
  
      // Print how may Sensors are there
      mSensorsTot.setText(msensorList.size()+" "+this.getString(R.string.sensors)+"!");
  
      // Print each Sensor available using sSensList as the String to be printed
      String sSensList = new String("");
      Sensor tmp;
      int x,i;
      for (i=0;i&lt;msensorList.size();i++){
       tmp = msensorList.get(i);
       sSensList = " "+sSensList+tmp.getName(); // Add the sensor name to the string of sensors available
      }
      // if there are sensors available show the list
      if (i&gt;0){
       sSensList = getString(R.string.sensors)+":"+sSensList;
       mSensorAvailables.setText(sSensList);
      }
  }
  </code></pre>