Code example for DialogFragment

Methods: getDialogonDestroyView, getRetainInstance

1
	/*dialog kept disappearing on orientation change.  might be a bug in v4 support. 
	 * http://stackoverflow.com/questions/12433397/android-dialogfragment-disappears-after-orientation-change 
	 * */ 
	@Override 
	 public void onDestroyView() { 
	     if (getDialog() != null && getRetainInstance())
	         getDialog().setDismissMessage(null);
	         super.onDestroyView(); 
	 } 
	 
	  @Override 
		public void onCreate(Bundle savedInstanceState) {
			// TODO Auto-generated method stub 
			super.onCreate(savedInstanceState);
			setRetainInstance(false);
	    } 
 
	  public void setProgressOfDialog(int value){
		   
		  if(dialog!=null)
			  dialog.setProgress(value);