pagertitlestrip を使用して単純なビュー ページャーを作成しようとしています。コードは次のとおりです: Adapter_PagerAdapter.java
package com.kolmajor.adabiyat;
import java.util.List;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class Adapter_PagerAdapter extends FragmentPagerAdapter {
private List<Fragment> fragments;
/**
* @param fm
* @param fragments
*/
public Adapter_PagerAdapter(FragmentManager fm, List<Fragment> fragments) {
super(fm);
this.fragments = fragments;
}
/* (non-Javadoc)
* @see android.support.v4.app.FragmentPagerAdapter#getItem(int)
*/
@Override
public Fragment getItem(int position) {
return this.fragments.get(position);
}
/* (non-Javadoc)
* @see android.support.v4.view.PagerAdapter#getCount()
*/
@Override
public int getCount() {
return this.fragments.size();
}
}
FragmentActivity_Main.java
package com.kolmajor.adabiyat;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
public class FragmentActivity_Main extends FragmentActivity {
private Adapter_PagerAdapter mPagerAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.activity_main);
//initialsie the pager
this.initialisePaging();
}
/**
* Initialise the fragments to be paged
*/
private void initialisePaging() {
List<Fragment> fragments = new Vector<Fragment>();
fragments.add(Fragment.instantiate(this, Fragment_Writers.class.getName()));
fragments.add(Fragment.instantiate(this, Fragment_Books.class.getName()));
this.mPagerAdapter = new Adapter_PagerAdapter(super.getSupportFragmentManager(), fragments);
ViewPager pager = (ViewPager)super.findViewById(R.id.viewpager);
pager.setAdapter(this.mPagerAdapter);
}
}
Eclipse が次の行にエラーを表示する理由がわかりません。
this.mPagerAdapter = new Adapter_PagerAdapter(super.getSupportFragmentManager(), fragments);
エラー :
The constructor Adapter_PagerAdapter(FragmentManager, List<Fragment>) is undefined
誰か助けてください……。