Code example for Fragment

Methods: getActivitygetArguments, getImageResource

0
//			textView.setGravity(Gravity.CENTER); 
//			textView.setText(Integer.toString(getArguments().getInt( 
//					ARG_SECTION_NUMBER))); 
//			return textView; 
			 
	        ImageView iv = new ImageView(getActivity());
	        iv.setImageResource(getImageResource(getArguments().getInt(ARG_SECTION_NUMBER)));
//	        iv.setImageResource(R.drawable.icon4); 
//	        iv.setBackgroundDrawable(getResources().getDrawable(args.getInt("MyImageResource"))); 
	        return iv; 
		} 
	} 
	 
	 
	public Fragment getItem(int i) {
 
	    Fragment fragment = new DummySectionFragment();
	    Bundle args = new Bundle();
	    args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, i);
	    args.putInt("MyImageResource", getImageResource(i));