title: Android listview is returning null?
body: <p>So I'm trying to make a tabbed application...But it keeps crashing with null pointer exception . I checked through all the variables that could be causing a null pointer and I think I've narrowed it down. </p>
  
  <pre><code>ListView activeList = (ListView) findViewById(R.id.activelist);
  if(activeList == null) {
    Log.e("com.name.app", "activeList null");
  }
  </code></pre>
  
  <p>This returns a null. Should it? I'm using fragments to try and build a tabbed layout. This is the xml it's referencing. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" 
      &gt;
  
      &lt;ListView
          android:id="@+id/activelist"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" 
          android:persistent="true" &gt;    
      &lt;/ListView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Thank you for any help! </p>
  
  <p>Edit: </p>
  
  <pre><code>    super.onCreate(savedInstanceState);
      setContentView(R.layout.tabs_layout);
  </code></pre>
  
  <p>That's what my contentview looks like.</p>
  
  <p>Edit:
  This is what my final code looked like! </p>
  
  <pre><code>    LayoutInflater inflater = (LayoutInflater)   getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
      LinearLayout mContainer = (LinearLayout)     inflater.inflate(R.layout.tab_frag1_layout, null); 
      ListView activeList = (ListView) mContainer.findViewById(R.id.activelist);
  </code></pre>