package epson.print; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; public class SimpleMessageDialogFragment extends DialogFragment { private static final String PARAM_MESSAGE_RESOURCE_ID = "message_id"; private int mMessageId; public static SimpleMessageDialogFragment newInstance(int i) { SimpleMessageDialogFragment simpleMessageDialogFragment = new SimpleMessageDialogFragment(); Bundle bundle = new Bundle(); bundle.putInt(PARAM_MESSAGE_RESOURCE_ID, i); simpleMessageDialogFragment.setArguments(bundle); return simpleMessageDialogFragment; } public void onCreate(Bundle bundle) { super.onCreate(bundle); mMessageId = getArguments().getInt(PARAM_MESSAGE_RESOURCE_ID); } @NonNull public Dialog onCreateDialog(Bundle bundle) { super.onCreateDialog(bundle); AlertDialog create = new AlertDialog.Builder(getActivity()).setMessage(mMessageId).setPositiveButton(R.string.ok_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { } }).create(); create.setCanceledOnTouchOutside(false); return create; } }