1 package com.weather.information.fragment;
3 import android.app.AlertDialog;
4 import android.app.Dialog;
5 import android.content.DialogInterface;
6 import android.os.Bundle;
7 import android.support.v4.app.DialogFragment;
9 public class ErrorDialogFragment extends DialogFragment {
11 public static ErrorDialogFragment newInstance(final int title) {
12 final ErrorDialogFragment frag = new ErrorDialogFragment();
13 final Bundle args = new Bundle();
15 args.putInt("title", title);
16 frag.setArguments(args);
22 public Dialog onCreateDialog(final Bundle savedInstanceState) {
23 final int title = this.getArguments().getInt("title");
25 return new AlertDialog.Builder(this.getActivity())
26 .setIcon(android.R.drawable.ic_dialog_alert)
28 .setPositiveButton(android.R.string.ok,
29 new DialogInterface.OnClickListener() {
31 public void onClick(final DialogInterface dialog,
32 final int whichButton) {
39 public void onDestroyView() {
40 if (getDialog() != null && getRetainInstance()) {
41 getDialog().setDismissMessage(null);
43 super.onDestroyView();