title: Attempt to invoke virtual method void android.widget.AdapterView.setAdapter(android.widget.Adapter)
body: <p>I want to use listview in viewpager.</p>
  
  <p>Here is my code:</p>
  
  <p>My Fragment: CampaignsFragment</p>
  
  <pre><code>@Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
      // BEGIN_INCLUDE (setup_viewpager)
      // Get the ViewPager and set it's PagerAdapter so that it can display items
      mViewPager = (ViewPager) view.findViewById(R.id.viewpager_campaigns);
      mViewPager.setAdapter(new CampaignsAdapter(getFragmentManager()));
      // END_INCLUDE (setup_viewpager)
  
  
      // BEGIN_INCLUDE (setup_slidingtablayout)
      // Give the SlidingTabLayout the ViewPager, this must be done AFTER the ViewPager has had
      // it's PagerAdapter set.
      mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs_campaigns);
      mSlidingTabLayout.setViewPager(mViewPager);
      // END_INCLUDE (setup_slidingtablayout)
  }
  </code></pre>
  
  <p>My adapter: CampaignsAdapter</p>
  
  <pre><code>public class CampaignsAdapter extends FragmentPagerAdapter {
  
      public CampaignsAdapter(FragmentManager fm) {
          super(fm);
      }
  
      /**
       * @return the number of pages to display
       */
      @Override
      public int getCount() {
          return 2;
      }
  
      @Override
      public Fragment getItem(int position) {
          String[] campaigns_type = {"active", "previous"};
  
          //Log.w(String.valueOf(position), String.valueOf(position));
          return CampaignsListFragment.newInstance(campaigns_type[position]);
      }
  }
  </code></pre>
  
  <p>This is my next fragment: CampaignsListFragment</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      if (getArguments() != null) {
          mCampaignType = getArguments().getString(ARG_CAMPAIGN_TYPE);
      }
  
      // TODO: Change Adapter to display your content
      mAdapter = new ArrayAdapter&lt;DummyContent.DummyItem&gt;(getActivity(),
              android.R.layout.simple_list_item_1, android.R.id.text1, DummyContent.ITEMS);
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.fragment_campaigns_list, container, false);
  
      // Set the adapter
      mListView = (AbsListView) view.findViewById(android.R.id.list);
      ((AdapterView&lt;ListAdapter&gt;) mListView).setAdapter(mAdapter);
  
      // Set OnItemClickListener so we can be notified on item clicks
      mListView.setOnItemClickListener(this);
  
      return view;
  }
  </code></pre>
  
  <p>But I faced problem:</p>
  
  <p>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.AdapterView.setAdapter(android.widget.Adapter)' on a null object reference
              at com.safaroff.bakcellroaming.CampaignsListFragment.onCreateView(CampaignsListFragment.java:83)</p>
  
  <p><img src="https://i.stack.imgur.com/BjKyj.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/EwMoI.png" alt="enter image description here"></p>
  
  <p>What's problem?</p>