title: onListItemClick not works in the listview using fragment
body: <p>I've already ask something like this one but i didn't find any solution.. Now i want try to find a way out posting the entire java code.
  The problem is that when i click over a item in the listview nothing happen. Seems that the <code>onListItemClick</code> is not fired.. This is the code:</p>
  
  <pre><code>@SuppressLint("NewApi")
  public class sensorsbattcpu extends Fragment{
      private ListView listView;
      private SensorManager mSensorManager;
      private List&lt;Sensor&gt; deviceSensors = null;
      public Context context;
      ListView list;
  
      public static final String PREF_CAPTURE_STATE = "captureState";
      public static final String PREF_CAPTURE_FILE = "captureStatePrefs";
      static final int MENU_CAPTURE_ON = 1;
      static final int MENU_CAPTURE_OFF = 2;
  
      /** Called when the activity is first created. */
      @SuppressLint("NewApi")
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          // Retrieving the currently selected item number
          int position = getArguments().getInt("position");
          // List of rivers
          String[] menus = getResources().getStringArray(R.array.menus);
          View v = inflater.inflate(R.layout.sensorsfragment, container, false);
          // Listview nel sensors.xml layout
          listView = ((ListView)v.findViewById(R.id.listView1));
  
  
              mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
              ArrayList&lt;SensorItem&gt; items = new ArrayList&lt;SensorItem&gt;();
              List&lt;Sensor&gt; sensors = mSensorManager.getSensorList( Sensor.TYPE_ALL );
              for( int i = 0 ; i &lt; sensors.size() ; ++i )
              items.add( new SensorItem( sensors.get( i ) ) );
  
              sensorAdapter = new ArrayAdapter( getActivity(),R.layout.customlistview,R.id.text1,items );
              listView.setAdapter( sensorAdapter );
              SharedPreferences appPrefs = getActivity().getSharedPreferences( PREF_CAPTURE_FILE, Context.MODE_PRIVATE );
              captureState = appPrefs.getBoolean( PREF_CAPTURE_STATE, false );
  
  
              return v;
          }
  
  
      public void onPause() {
          super.onPause();
          SharedPreferences appPrefs = getActivity().getSharedPreferences( PREF_CAPTURE_FILE, Context.MODE_PRIVATE );
          SharedPreferences.Editor ed = appPrefs.edit();
          ed.putBoolean( PREF_CAPTURE_STATE, captureState );
          ed.commit();
      }
  
      public boolean onCreateOptionsMenu(Menu menu) {
          boolean result = onCreateOptionsMenu(menu);
          menu.add(0, MENU_CAPTURE_ON, 1, R.string.capture_on );
          menu.add(0, MENU_CAPTURE_OFF, 2, R.string.capture_off );
          return result;
      }
  
      public boolean onOptionsItemSelected(MenuItem item) {
          int id = item.getItemId();
          switch( id ) {
              case MENU_CAPTURE_ON:
                  captureState = true;
                  break;
  
              case MENU_CAPTURE_OFF:
                  captureState = false;
                  break;
          }
          return true;
      }
  
      @SuppressLint("NewApi")
      protected void onListItemClick(ListView l, View v, int positionItem, long id) {
  
          Sensor sensor = sensorAdapter.getItem( positionItem ).getSensor();
          String sensorName = sensor.getName();
  Intent i = new Intent();
          i.setClassName( "com.ab.myapp","com.ab.myapp.SensorMonitor" );
          i.putExtra( "sensorname",sensorName );
          startActivity( i );
      }
  
  
      private ArrayAdapter&lt;SensorItem&gt; sensorAdapter;
      private boolean captureState = false;
  
      class SensorItem {
          SensorItem( Sensor sensor ) {
              this.sensor = sensor;
          }
  
          @SuppressLint("NewApi")
          public String toString() {
              return sensor.getName();
          }
  
          Sensor getSensor() {
              return sensor;
          }
  
          private Sensor sensor;
      }
  
  }
  </code></pre>
  
  <p>Please i need a help.. The goal is click on a item and open the other activity. Thanks</p>