public static InformationDialogFragment newInstance( String title, String body, boolean isHTML, DialogCallback dialogCallback) { if (title == null || body == null) { throw new InvalidParameterException("Title and body cannot be null"); } InformationDialogFragment dialog = new InformationDialogFragment(); Bundle args = new Bundle(); args.putString(BUNDLE_TITLE, title); args.putString(BUNDLE_BODY, body); args.putBoolean(BUNDLE_ISHTML, isHTML); dialog.setArguments(args); callback = dialogCallback; return dialog; }
/** Displays a generic 'information' dialog */ private void showInformationDialog(String title, String body) { FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } // Create and show the dialog. DialogFragment newFragment = InformationDialogFragment.newInstance(title, body, true, null); newFragment.show(ft, "dialog"); }