title: ListView findViewById returning null
body: <p>I'm not using a ListActivity because I want to extend FragmentActivity. Instead I'm trying to use:</p>
  
  <pre><code>ListView lv = (ListView) findViewById(R.id.mainListView);
  </code></pre>
  
  <p>Unfortunately lv is null.</p>
  
  <p>In my xml I have:</p>
  
  <pre><code> &lt;ListView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/mainListView"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1" &gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>I've also tried using different android id's for the list view such as the one you have to use when you use ListActivity, but it's always Null.</p>
  
  <p>Edit: I was trying to call findViewById before calling setContentView. Calling setContentView first fixed it.</p>