ViewPagerExtensionsを使用しています。PagerAdapterクラスの各タブで新しいアクティビティを開始したいと思います。
現在、これはデフォルトのコードです。
@Override
public Object instantiateItem(ViewGroup container, int position) {
RelativeLayout v = new RelativeLayout(mContext);
TextView t = new TextView(mContext);
t.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
t.setText(mData[position]);
t.setTextSize(30);
t.setGravity(Gravity.CENTER);
v.addView(t);
((ViewPager) container).addView(v, 0);
return v;
}
私はそれがアンドロイドタブのために行われるように何かをしたいです:
@Override
public Object instantiateItem(View container, int position) {
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, NewActivity.class);
}
これにより、エラーがスローされますThe method setClass(Context, Class<?>) in the type Intent is not applicable for the arguments (PagerAdapter, Class<NewActivity>)
。