Code example for Fragment

Methods: getActivity

0
		// create a new fragment 
		Fragment f = new ExampleFragment();
		//Fragment f = new ExampleListFragment(); 
		 
		// get the activity and add the new fragment after this one! 
		Activity a = getActivity();
		if (a != null && a instanceof FragmentLauncher)
			((FragmentLauncher) a).addFragment(ExampleFragment.this, f);
	} 
 
	public ExampleFragment() { 
		super(); 
	} 
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		setRetainInstance(true);
 
		parentView = inflater.inflate(R.layout.example_fragment, container, false);
		if (color != -1) {