Code example for DialogFragment

Methods: getActivity, onDismiss

0
        return builder.create();
    } 
     
	@Override 
	public void onDismiss(DialogInterface dialog) {
		super.onDismiss(dialog);
		ShuffleMain activity = (ShuffleMain)this.getActivity();
		if (activity != null) { // activity still exists. Is null when dialog is dismissed
								// due to activity destroyed. 
			activity.clearDialog();
		} 
	} 
	 
	public String getInputName() {
		 
		EditText editText = (EditText) getDialog().findViewById(R.id.editAddPlayer);
		return editText.getText().toString();
	} 
}