在活动类中,我有这个类(来自
android示例):
public static class DemoCollectionPagerAdapter extends FragmentStatePagerAdapter { public DemoCollectionPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { Fragment fragment = new QuestionFragment(); Bundle args = new Bundle(); args.putInt(QuestionFragment.ARG_OBJECT,i ); fragment.setArguments(args); return fragment; } @Override public int getCount() { return questionList.length; } @Override public CharSequence getPageTitle(int position) { return "Title n°" + (position + 1); } }
我想改变这个:返回“标题n°”(位置1);
to:return getActivity().getResources().getString(R.string.questionTabTitle)(position 1);
但活动未定义.我怎么能得到我需要的字符串资源?