Code example for Fragment

Methods: getArguments, onDetach

0
			Log.d(TAG, "Attached " + getArguments().getInt("position"));
		} 
 
		@Override 
		public void onDetach() { 
			Log.d(TAG, "Detached " + getArguments().getInt("position"));
			super.onDetach(); 
		} 
	} 
 
	private class MyFragmentPagerAdapter extends FragmentStatePagerAdapter { 
		public MyFragmentPagerAdapter(FragmentManager fm) {
			super(fm);
		} 
 
		@Override 
		public Fragment getItem(int position) {
			Bundle args = new Bundle();
			args.putInt("position", position);
			return Fragment.instantiate(getActivity(),
					MyFragment.class.getName(), args);