title: Android - NullPointerException on setAdapter ViewPager
body: <p>I have a little problem. I'm trying to create a layout with fragment, but when I call the <code>setAdapter</code> method I have a Java <code>NullPointerException</code>, and I can't find the error.
  Thanks all!</p>
  
  <p><b>Class Code</b></p>
  
  <pre><code>public class Agenda extends FragmentActivity{
  
  PagerAdapter mPagerAdapter;
  
  ViewPager mViewPager;
  
  protected void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.agenda_sw);
  
      mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
  
      // Set up the ViewPager with the sections adapter.
      mViewPager = (ViewPager) findViewById(R.id.agendaPager);
  
      mViewPager.setAdapter(mPagerAdapter); //Line 32, the error is on this line.
  
  }
  </code></pre>
  
  <p><b> xml code </b></p>
  
  <pre><code>&lt;android.support.v4.view.ViewPager
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/agenda_sw"
  android:layout_width="match_parent"
  android:layout_height="match_parent" 
  /&gt;
  </code></pre>
  
  <p><b> LogCat </b></p>
  
  <pre><code>03-04 11:06:14.686: E/AndroidRuntime(1356): FATAL EXCEPTION: main
  03-04 11:06:14.686: E/AndroidRuntime(1356): java.lang.RuntimeException: Unable to start activity ComponentInfo{conf.main/conf.main.Agenda}: java.lang.NullPointerException
  ...
  03-04 11:06:14.686: E/AndroidRuntime(1356): Caused by: java.lang.NullPointerException
  03-04 11:06:14.686: E/AndroidRuntime(1356): at conf.main.Agenda.onCreate(Agenda.java:32)
  </code></pre>