老实说,我在询问之前对此进行了一些搜索。如何从活动接收意图fragmentactivity
我正在尝试使用 viewpager。我在获取参数时遇到错误Bundle extras = getArguments();
public class SingleViewActivity extends FragmentActivity {
ImageView imageView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page_view);
ArrayList<Listitem> personArrayList = new ArrayList<Listitem>();
// Listitem item = new Listitem("1", "http://developer.android.com/assets/images/android_logo.png");//I used to add it staticly
Bundle extras = getArguments();
if (extras != null) {
extras = extras.getParcelableArrayList(ARG_PERSON_LIST);
personArrayList.add(item); }
// DemoObjectFragment f = DemoObjectFragment.newInstance(personArrayList);
ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
Log.d("s", "singleview");
DemoCollectionPagerAdapter mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter( getSupportFragmentManager(),personArrayList);
mViewPager.setAdapter(mDemoCollectionPagerAdapter);