vijay
11/2/2014 - 9:02 AM

Replacing Fragments and Sending Arguments

Replacing Fragments and Sending Arguments

	public void replaceFragment() {
		Fragment fragment_ob = new AddNewTaskFragment();
		
		FragmentTransaction transaction_ob = getFragmentManager()
				.beginTransaction();
				
		// pass values from fragment
		Bundle bundle_ob = new Bundle();
		bundle_ob.putString("contact_name", name);

		transaction_ob.replace(R.id.lin_frg_placeholder, fragment_ob);
	//R.id.lin_frg_placeholder is space in activity which is replaced by fragment. 

		transaction_ob.commit();
	}
	
	// receiving the arguments from fragment(Class)
	//Do this in onCreateView
	String contact_name = getArguments().getString("contact_name");