Instantly launch PagerAdapter Android

Guys, I'm trying to create an application using a horizontal pager and a support package for Android. I adjusted this exact code in another project, but the last line of the second code example does not allow me to compile. Eclipse saysCannot instantiate the type PagerAdapter

My import

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;

My code

List<Fragment> fragments = new Vector<Fragment>();
    fragments.add(Fragment.instantiate(this, Tab1.class.getName()));
    fragments.add(Fragment.instantiate(this, Tab2.class.getName()));
    fragments.add(Fragment.instantiate(this, Tab3.class.getName()));
    this.mPagerAdapter  = new PagerAdapter(super.getSupportFragmentManager(), fragments);

Do you think that something is wrong with my import or project? - let me know if you need more information. This code worked in other projects.

thank

+5
source share
2 answers

PagerAdapter is a class abstract- you cannot create it. You need to create a new class that inherits from PagerAdapterand use it instead.

+9
source

, PagerAdapter .

. . "import android.support.v4.view.PagerAdapter;" .

+2

All Articles