I'm using ViewPagerExtensions. I would like to start a new activity in each tab in the Pager Adapter class.
Right now this is the default code:
@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;
}
I would like to do something as it is done for the android tabs:
@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);
}
This throws the error: The method setClass(Context, Class<?>) in the type Intent is not applicable for the arguments (PagerAdapter, Class<NewActivity>)
.