@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); app = (GeoTage) getApplication(); mContext = this; layout = LayoutInflater.from(mContext).inflate(R.layout.rock_detail, null); setContentView(layout); mPager = (ViewPager) findViewById(R.id.main_viewpager); adapter = new ViewPagerAdapter(getSupportFragmentManager()); mPager = (ViewPager) layout.findViewById(R.id.rock_detail_viewpager); mPager.setAdapter(adapter); mPager.setOnPageChangeListener(this); mPager.setOffscreenPageLimit(3); // adapter.addFragment(new AddPlaceFragment()); app.setActiveMenu(layout, menuIds, 0); rockId = getIntent().getIntExtra("rock_id", 0); rock = getIntent().getParcelableExtra("rock"); if (rock == null) { rock = new Rock(); } Bundle args = new Bundle(); args.putParcelable("rock", rock); mRockDesc = new RockDescFragment(); // mRockLocation = new RockLocation(); mRockComments = new RockCommentsFragment(); mRockDesc.setArguments(args); // mRockLocation.setArguments(args); mRockComments.setArguments(args); adapter.addFragment(mRockDesc); // adapter.addFragment(mRockLocation); adapter.addFragment(mRockComments); receiver = new NewCommentReceiver(); getRockDetail(); }
@Override public void onPageSelected(int arg0) { app.setActiveMenu(layout, menuIds, arg0); }