title: Cannot instantiate the type PagerAdapter
body: <p>I am working with fragments and <code>pageview</code> trying to use a horizontal pager and i got the following error:</p>
  
  <pre><code>Cannot instantiate the type PagerAdapter.
  </code></pre>
  
  <p>I know that <code>PagerAdapter</code> is an abstract class, so i created a new class that inherits from <code>PagerAdapter</code> and used that instead.
  But didn't fix it.</p>
  
  <p>that's my code:</p>
  
  <p>main activity import</p>
  
  <pre><code>import java.util.List;
  import java.util.Vector;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.view.ViewPager;
  import android.support.v7.app.ActionBarActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  //import com.example.prova.PagerAdapter;
  //import android.support.v4.view.PagerAdapter;
  </code></pre>
  
  <p>Main Activity where i have the error when i try to create a pageradapter</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  
      List&lt;Fragment&gt; fragments = new Vector&lt;Fragment&gt;();
      private ViewPager mPager;
      PagerAdapter mPagerAdapter; 
      //mPager.setCurrentItem(2);
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
       // creating fragments and adding to list
          fragments.add(Fragment.instantiate(this,Timeline.class.getName()));
          fragments.add(Fragment.instantiate(this,Postit.class.getName()));
          fragments.add(Fragment.instantiate(this,Frase.class.getName()));
          fragments.add(Fragment.instantiate(this,Impostazioni.class.getName()));
  
       // creating adapter and linking to view pager
          this.mPagerAdapter=new PagerAdapter(super.getSupportFragmentManager(),fragments); //I GOT HERE THE ERROR
          mPager = (ViewPager) super.findViewById(R.id.pager);
          mPager.setAdapter(this.mPagerAdapter);
      }
  </code></pre>
  
  <p>And here my PagerAdapter</p>
  
  <pre><code>public abstract class PagerAdapter extends FragmentPagerAdapter {
  
     // fragments to instantiate in the viewpager
     private List&lt;Fragment&gt; fragments;
  
     // constructor
     public PagerAdapter(FragmentManager fm,List&lt;Fragment&gt; fragments) {
        super(fm);
        this.fragments = fragments;
     }
  
     // return access to fragment from position, required override
     @Override
     public Fragment getItem(int position) {
        return this.fragments.get(position);
     }
  
     // number of fragments in list, required override
     @Override
     public int getCount() {
        return this.fragments.size();
     }
  
  }
  </code></pre>