Code example for DialogFragment

Methods: getArguments, onAttach

0
		return frag;
	} 
	 
	@Override 
	public void onAttach(Activity activity) {
		super.onAttach(activity);
		 
		FragmentActivity fragActivity = (FragmentActivity) activity;
		 
		if(getArguments().containsKey("listener_fragment_id")) {
			Fragment frag = fragActivity.getSupportFragmentManager().findFragmentById(
					getArguments().getInt("listener_fragment_id"));
			try { 
				mListener = (OnDecisionMadeListener) frag;
			}catch(ClassCastException e) {
				throw new ClassCastException(frag
						+ " must implement the OnDecisionMadeListener interface."); 
			} 
		}else{ 
			try { 
				mListener = (OnDecisionMadeListener) activity;