title: Starting new activity from ListFragment using onListItemClick()
body: <p>Right now I have an app that searches and returns items in a ListFragment.  I want to be able to make each ListFragment clickable, such that when it is clicked, a new activity starts using something like this:</p>
  
  <pre><code>public void onListItemClick(ListView listView, View view, int position, long id) {
      Intent i = new Intent(this, PlaceView.class);
      startActivity(i);
      //eventually data from the List will be passed to the new Activity...
  }
  </code></pre>
  
  <p>The class that starts the ListFragment that I need to be clickable is as follows:</p>
  
  <pre><code>public class ResultsView extends FragmentActivity {
  
  private ArrayAdapter&lt;String&gt; mAdapter;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_results_view);
  
          //Receive searchTerm from MainActivity
          Intent intent = getIntent();
          String searchTerm = intent.getStringExtra(MainActivity.SEARCH_TERM);
  
          mAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.item_label_list);
  
          FragmentManager     fm = getSupportFragmentManager();
          FragmentTransaction ft = fm.beginTransaction();
  
          ListFragment list = new ListFragment();
          ft.add(R.id.fragment_content, list);
  
          // Let's set our list adapter to a simple ArrayAdapter.
          list.setListAdapter(mAdapter);
  
          FactualResponderFragment responder = (FactualResponderFragment) fm.findFragmentByTag("RESTResponder");
          if (responder == null) {
              responder = new FactualResponderFragment();
  
              ft.add(responder, "RESTResponder");
          }
  
          Bundle bundle = new Bundle();
          bundle.putString("search_term", searchTerm);
          responder.setArguments(bundle);
  
          ft.commit();
      }
  
      public ArrayAdapter&lt;String&gt; getArrayAdapter() {
          return mAdapter;
      }
  
      public void onListItemClick(ListView listView, View view, int position, long id) {
          Intent i = new Intent(this, PlaceView.class);
          startActivity(i);
      }
  </code></pre>
  
  <p>So my questions are:</p>
  
  <p>1) How do I set up the <code>onListItemClick()</code> to work with the <code>ListFragment list</code> that I am working with?</p>
  
  <p>2) <code>ListView</code> doesn't have any XML attributes that relate to <code>onClick</code> or the like.  Does that not matter?</p>
  
  <p>3) Where should the <code>onListItemClick()</code>, <code>onItemClickListener()</code> and anything else applicable be?</p>
  
  <p>Thanks for your help.</p>
  
  <p>EDIT:</p>
  
  <p>Following Pramod's advice, I made a class: <code>ListFragmentClickable extends ListFragment</code>, and populated it with the following:      </p>
  
  <pre><code>@Override
  public void onListItemClick(ListView listView, View view, int position, long id) {
      Intent i = new Intent(this, PlaceView.class);
      startActivity(i);
  }
  </code></pre>
  
  <p>Eclipse tells me that <code>new Intent(this, PlaceView.class)</code> is not allowed, and that I only can say <code>Intent i = new Intent();</code>. The error is "The constructor Intent(ListFragmentClickable, Class) is undefined." I tried instantiating the Intent as Eclipse suggested, and then added <code>i.setClass(this, PlaceView.class)</code> and <code>i.setClassName(this, PlaceView.class)</code> but it didn't work as I got the same error.</p>
  
  <p>1) How do I get around this error and override the method as planned?</p>
  
  <p>2) If I can't do that, and have to use <code>Intent i = new Intent();</code>, how do I tell the intent what class we're even aiming at?</p>