MemcardTempAlertDialogFragment.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.epson.memcardacc;
  2. import android.app.AlertDialog;
  3. import android.app.Dialog;
  4. import android.content.DialogInterface;
  5. import android.os.Bundle;
  6. import android.support.p000v4.app.DialogFragment;
  7. public class MemcardTempAlertDialogFragment extends DialogFragment {
  8. private static final String KEY_MESSAGE = "message";
  9. public interface DialogCallback {
  10. void onPositiveCallback();
  11. }
  12. public static MemcardTempAlertDialogFragment newInstance(String str) {
  13. MemcardTempAlertDialogFragment memcardTempAlertDialogFragment = new MemcardTempAlertDialogFragment();
  14. Bundle bundle = new Bundle();
  15. bundle.putString("message", str);
  16. memcardTempAlertDialogFragment.setArguments(bundle);
  17. return memcardTempAlertDialogFragment;
  18. }
  19. public Dialog onCreateDialog(Bundle bundle) {
  20. String string = getArguments().getString("message");
  21. if (string == null) {
  22. string = "";
  23. }
  24. AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  25. builder.setMessage(string).setPositiveButton(getActivity().getString(R.string.str_ok), new DialogInterface.OnClickListener() {
  26. public void onClick(DialogInterface dialogInterface, int i) {
  27. }
  28. });
  29. AlertDialog create = builder.create();
  30. create.setCanceledOnTouchOutside(false);
  31. return create;
  32. }
  33. }