Example usage for android.app AlertDialog.Builder setOnCancelListener

List of usage examples for android.app AlertDialog.Builder setOnCancelListener

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setOnCancelListener.

Prototype

public void setOnCancelListener(@Nullable OnCancelListener listener) 

Source Link

Document

Set a listener to be invoked when the dialog is canceled.

Usage

From source file:org.catrobat.catroid.ui.fragment.SoundFragment.java

private void showConfirmDeleteDialog() {
    int titleId;/*from w  ww  . j a  v a2  s  .c om*/
    if (adapter.getAmountOfCheckedItems() == 1) {
        titleId = R.string.dialog_confirm_delete_sound_title;
    } else {
        titleId = R.string.dialog_confirm_delete_multiple_sounds_title;
    }

    AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity());
    builder.setTitle(titleId);
    builder.setMessage(R.string.dialog_confirm_delete_sound_message);
    builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            SoundController.getInstance().deleteCheckedSounds(getActivity(), adapter, soundInfoList,
                    mediaPlayer);
            clearCheckedSoundsAndEnableButtons();
        }
    });
    builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });

    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            clearCheckedSoundsAndEnableButtons();
        }
    });

    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}

From source file:com.apotheosis.acceleration.monitor.MainMenuActivity.java

private void setUpListView() {
    ListView lv = (ListView) findViewById(R.id.fileList);

    List<String> fileNames = FileUtilities.getFileList();

    if (fileNames != null) {
        FileListAdapter listAdapter = new FileListAdapter(this);

        lv.setAdapter(listAdapter);/* w  w  w  .  j  a  v a2  s .c  o m*/
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.mainDrawerLayout);
                boolean isDrawerOpen = drawerLayout.isDrawerOpen(findViewById(R.id.side_drawer));

                if (isDrawerOpen)
                    drawerLayout.closeDrawers();

                new LoadData(TimeXYZDataPackage.DataType.ACCELERATION, MainMenuActivity.this,
                        parent.getAdapter().getItem(position).toString()).execute((Void[]) null);
            }
        });

        lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
                final String fileName = parent.getAdapter().getItem(position).toString();
                final AlertDialog.Builder optionsMenu = new AlertDialog.Builder(MainMenuActivity.this);
                optionsMenu.setItems(new String[] { "Open Acceleration Graph", "Open Raw Data", "Share Data",
                        "Delete Data", "Cancel" }, new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {

                                DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.mainDrawerLayout);
                                boolean isDrawerOpen = drawerLayout
                                        .isDrawerOpen(findViewById(R.id.side_drawer));

                                Intent i;
                                Tracker tracker;
                                switch (which) {
                                case 0:
                                    dialog.dismiss();

                                    if (isDrawerOpen)
                                        drawerLayout.closeDrawers();

                                    new LoadData(TimeXYZDataPackage.DataType.ACCELERATION,
                                            MainMenuActivity.this, fileName).execute((Void[]) null);
                                    break;

                                case 1:

                                    if (isDrawerOpen)
                                        drawerLayout.closeDrawers();

                                    new LoadData(TimeXYZDataPackage.DataType.RAW_DATA, MainMenuActivity.this,
                                            fileName).execute((Void[]) null);

                                    break;

                                case 2:

                                    if (isDrawerOpen)
                                        drawerLayout.closeDrawers();

                                    tracker = AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
                                    tracker.send(new HitBuilders.EventBuilder().setCategory("Data Function")
                                            .setAction("Share Data").build());

                                    i = new Intent(Intent.ACTION_SEND);
                                    i.setType("text/xml");
                                    i.putExtra(Intent.EXTRA_SUBJECT, "Sending " + fileName + "as attachment");
                                    i.putExtra(Intent.EXTRA_TEXT, fileName + "is attached.");
                                    File f = new File(FileUtilities.path + fileName + ".csv");
                                    i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
                                    startActivity(Intent.createChooser(i, "Choose an application..."));
                                    break;

                                case 3:
                                    final AlertDialog.Builder confirmDelete = new AlertDialog.Builder(
                                            MainMenuActivity.this);
                                    confirmDelete
                                            .setMessage("Are you sure you want to delete " + fileName + "?");
                                    confirmDelete.setPositiveButton("Yes",
                                            new DialogInterface.OnClickListener() {
                                                public void onClick(DialogInterface dialog, int which) {
                                                    File f = new File(FileUtilities.path + fileName + ".csv");
                                                    Log.d("DELETION_SUCESS", String.valueOf(f.delete()));
                                                    setUpListView();
                                                }
                                            });
                                    confirmDelete.setNegativeButton("No",
                                            new DialogInterface.OnClickListener() {
                                                public void onClick(DialogInterface dialog, int which) {
                                                    dialog.dismiss();
                                                }
                                            });
                                    confirmDelete.setOnCancelListener(new DialogInterface.OnCancelListener() {
                                        public void onCancel(DialogInterface dialog) {
                                            dialog.dismiss();
                                        }
                                    });
                                    confirmDelete.show();
                                    break;
                                }
                            }
                        });

                optionsMenu.show();
                return true;
            }
        });
    }
}

From source file:de.enlightened.peris.IntroScreen.java

private void askAboutWebview() {
    final AlertDialog.Builder builder = new AlertDialog.Builder(IntroScreen.this);
    builder.setTitle("Tapatalk API Not Found");
    builder.setCancelable(true);// w w w. j av  a2 s  .c  o  m
    builder.setPositiveButton("Try WebView", new DialogInterface.OnClickListener() {

        @SuppressWarnings("checkstyle:requirethis")
        public void onClick(final DialogInterface dialog, final int which) {
            addWebViewServer(serverInputter.getText().toString().trim());

            refreshList();

            serverInputter.setText("");

            final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(serverInputter.getWindowToken(), 0);
        }
    });
    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int which) {
            //do nothing
        }
    });
    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
        public void onCancel(final DialogInterface dialog) {
            //do nothing
        }
    });

    builder.setMessage(
            "The Tapatalk API cannot be found at the URL you provided.  Do you want to view this forum in a WebView instead?  If not, you can go back and try to re-enter your server information.");
    builder.create().show();

    return;
}

From source file:de.enlightened.peris.IntroScreen.java

private void stealTapatalkLink(final String link) {
    final String queryLink;

    if (!link.startsWith("http://")) {
        queryLink = "http://" + link;
    } else {/*from  w ww  .  ja  v a  2  s.c om*/
        queryLink = link;
    }

    if (!getString(R.string.server_location).contentEquals("0")) {
        if (queryLink.contentEquals(getString(R.string.server_location))) {
            this.connectToServer(this.selectedServer);
        } else {
            final AlertDialog.Builder builder = new AlertDialog.Builder(IntroScreen.this);
            builder.setTitle("Download Peris");
            builder.setCancelable(true);
            builder.setPositiveButton("Yep!", new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int which) {

                    final String perisURL = "https://github.com/McNetic/peris/";
                    final Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse(perisURL));
                    IntroScreen.this.startActivity(intent);

                    finish();
                }
            });
            builder.setNegativeButton("Nah.", new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int which) {
                    finish();
                }
            });
            builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
                public void onCancel(final DialogInterface dialog) {
                    finish();
                }
            });

            builder.setMessage("Do you want to download and view " + link
                    + " using Peris, the free mobile forum reader app that " + getString(R.string.app_name)
                    + " is based off of?");
            builder.create().show();
        }
    } else {
        this.selectedServer = ServerRepository.findOneByAddress(this.dbHelper.getReadableDatabase(), queryLink);
        if (this.selectedServer != null) {
            if (this.selectedServer.serverAddress != null) {
                this.connectToServer(this.selectedServer);
                return;
            }
        }

        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
            new ServerValidationTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, link.trim());
        } else {
            new ServerValidationTask().execute(link.trim());
        }
    }
}

From source file:jp.watnow.plugins.dialog.Notification.java

/**
 * Builds and shows a native Android alert with given Strings
 * @param message           The message the alert should display
 * @param title             The title of the alert
 * @param buttonLabel       The label of the button
 * @param callbackContext   The callback context
 *///ww w .j  ava2s. c o m
public synchronized void list(final String title, final JSONArray data, final CallbackContext callbackContext) {
    final CordovaInterface cordova = this.cordova;

    final String[] options = new String[data.length()];
    for (int i = 0; i < data.length(); i++) {
        try {
            options[i] = data.getString(i);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    Runnable runnable = new Runnable() {
        public void run() {
            final JSONObject result = new JSONObject();
            AlertDialog.Builder dlg = createDialog(cordova); // new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
            dlg.setTitle(title);
            dlg.setCancelable(false);
            dlg.setItems(options, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    try {
                        result.put("buttonIndex", 1);
                        result.put("selectedIndex", which);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
                }
            });
            dlg.setNegativeButton("Cancel", new AlertDialog.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    try {
                        result.put("buttonIndex", 0);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
                }
            });
            dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                    try {
                        result.put("buttonIndex", 0);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
                }
            });

            changeTextDirection(dlg);
        };
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}

From source file:ca.rmen.android.networkmonitor.app.dialog.ConfirmDialogFragment.java

/**
 * @return a Dialog with a title, message, ok, and cancel buttons.
 *//*  w w  w  . j a  v  a2 s.com*/
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Log.v(TAG, "onCreateDialog: savedInstanceState = " + savedInstanceState);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    Bundle arguments = getArguments();
    builder.setTitle(arguments.getString(DialogFragmentFactory.EXTRA_TITLE));
    builder.setMessage(arguments.getString(DialogFragmentFactory.EXTRA_MESSAGE));
    final int actionId = arguments.getInt(DialogFragmentFactory.EXTRA_ACTION_ID);
    final Bundle extras = arguments.getBundle(DialogFragmentFactory.EXTRA_EXTRAS);
    OnClickListener positiveListener = null;
    OnClickListener negativeListener = null;
    if (getActivity() instanceof DialogButtonListener) {
        positiveListener = new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Log.v(TAG, "onClick (positive button");
                FragmentActivity activity = getActivity();
                if (activity == null)
                    Log.w(TAG, "User clicked on dialog after it was detached from activity. Monkey?");
                else
                    ((DialogButtonListener) activity).onOkClicked(actionId, extras);
            }
        };
        negativeListener = new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Log.v(TAG, "onClick (negative button");
                FragmentActivity activity = getActivity();
                if (activity == null)
                    Log.w(TAG, "User clicked on dialog after it was detached from activity. Monkey?");
                else
                    ((DialogButtonListener) activity).onCancelClicked(actionId, extras);
            }
        };
    }
    builder.setNegativeButton(android.R.string.cancel, negativeListener);
    builder.setPositiveButton(android.R.string.ok, positiveListener);
    if (getActivity() instanceof OnCancelListener)
        builder.setOnCancelListener((OnCancelListener) getActivity());
    final Dialog dialog = builder.create();
    if (getActivity() instanceof OnDismissListener)
        dialog.setOnDismissListener((OnDismissListener) getActivity());
    return dialog;

}

From source file:com.onesignal.GenerateNotification.java

private static int showNotificationAsAlert(final JSONObject gcmJson, final Activity activity) {
    final int aNotificationId = new Random().nextInt();

    activity.runOnUiThread(new Runnable() {
        @Override//from  w ww  .j  a  va2s.  c  o m
        public void run() {
            AlertDialog.Builder builder = new AlertDialog.Builder(activity);
            builder.setTitle(getTitle(gcmJson));
            try {
                builder.setMessage(gcmJson.getString("alert"));
            } catch (Throwable t) {
            }

            List<String> buttonsLabels = new ArrayList<String>();
            List<String> buttonIds = new ArrayList<String>();

            addAlertButtons(gcmJson, buttonsLabels, buttonIds);

            final List<String> finalButtonIds = buttonIds;

            Intent buttonIntent = getNewBaseIntent(aNotificationId);
            buttonIntent.putExtra("action_button", true);
            buttonIntent.putExtra("from_alert", true);
            buttonIntent.putExtra("onesignal_data", gcmJson.toString());
            try {
                if (gcmJson.has("grp"))
                    buttonIntent.putExtra("grp", gcmJson.getString("grp"));
            } catch (JSONException e) {
            }

            final Intent finalButtonIntent = buttonIntent;

            DialogInterface.OnClickListener buttonListener = new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    int index = which + 3;

                    if (finalButtonIds.size() > 1) {
                        try {
                            JSONObject customJson = new JSONObject(gcmJson.getString("custom"));
                            JSONObject additionalDataJSON = customJson.getJSONObject("a");
                            additionalDataJSON.put("actionSelected", finalButtonIds.get(index));

                            JSONObject newJsonData = new JSONObject(gcmJson.toString());
                            newJsonData.put("custom", customJson.toString());

                            finalButtonIntent.putExtra("onesignal_data", newJsonData.toString());

                            NotificationOpenedProcessor.processIntent(activity, finalButtonIntent);
                        } catch (Throwable t) {
                        }
                    } else // No action buttons, close button simply pressed.
                        NotificationOpenedProcessor.processIntent(activity, finalButtonIntent);
                }
            };

            // Back button pressed
            builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    NotificationOpenedProcessor.processIntent(activity, finalButtonIntent);
                }
            });

            for (int i = 0; i < buttonsLabels.size(); i++) {
                if (i == 0)
                    builder.setNeutralButton(buttonsLabels.get(i), buttonListener);
                else if (i == 1)
                    builder.setNegativeButton(buttonsLabels.get(i), buttonListener);
                else if (i == 2)
                    builder.setPositiveButton(buttonsLabels.get(i), buttonListener);
            }

            AlertDialog alertDialog = builder.create();
            alertDialog.setCanceledOnTouchOutside(false);
            alertDialog.show();
        }
    });

    return aNotificationId;
}

From source file:com.app.blockydemo.ui.adapter.BrickAdapter.java

private void showConfirmDeleteDialog(int itemPosition) {
    this.clickItemPosition = itemPosition;
    int titleId;/* ww w  .  j  a v  a  2s  .  c o  m*/

    if (getItem(clickItemPosition) instanceof ScriptBrick) {
        titleId = R.string.dialog_confirm_delete_script_title;
    } else {
        titleId = R.string.dialog_confirm_delete_brick_title;
    }

    AlertDialog.Builder builder = new CustomAlertDialogBuilder(context);
    builder.setTitle(titleId);
    builder.setMessage(R.string.dialog_confirm_delete_brick_message);
    builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            if (getItem(clickItemPosition) instanceof ScriptBrick) {
                scriptToDelete = ((ScriptBrick) getItem(clickItemPosition))
                        .initScript(ProjectManager.getInstance().getCurrentSprite());
                handleScriptDelete(sprite, scriptToDelete);
                scriptToDelete = null;
            } else {
                removeFromBrickListAndProject(clickItemPosition, false);
            }
        }
    });
    builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            scriptToDelete = null;
        }
    });

    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}

From source file:com.dahl.brendan.wordsearch.view.WordSearchActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog;/*  www .  j  a va2 s.c om*/
    switch (id) {
    case DIALOG_ID_NO_WORDS: {
        final DialogNoWordsListener DIALOG_LISTENER_NO_WORDS = new DialogNoWordsListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.no_words);
        builder.setNegativeButton(R.string.category, DIALOG_LISTENER_NO_WORDS);
        builder.setPositiveButton(R.string.new_game, DIALOG_LISTENER_NO_WORDS);
        builder.setNeutralButton(R.string.size, DIALOG_LISTENER_NO_WORDS);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_NO_WORDS_CUSTOM: {
        final DialogNoWordsCustomListener DIALOG_LISTENER_NO_WORDS_CUSTOM = new DialogNoWordsCustomListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.no_words_custom);
        builder.setNegativeButton(R.string.category, DIALOG_LISTENER_NO_WORDS_CUSTOM);
        builder.setPositiveButton(R.string.custom_editor, DIALOG_LISTENER_NO_WORDS_CUSTOM);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_GAME_OVER: {
        final DialogGameOverListener DIALOG_LISTENER_GAME_OVER = new DialogGameOverListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("blank");
        EditText text = new EditText(this);
        text.setSingleLine();
        text.setId(android.R.id.input);
        builder.setView(text);
        builder.setPositiveButton(R.string.SAVE_SUBMIT, DIALOG_LISTENER_GAME_OVER);
        builder.setNeutralButton(R.string.SAVE, DIALOG_LISTENER_GAME_OVER);
        builder.setOnCancelListener(DIALOG_LISTENER_GAME_OVER);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_HIGH_SCORES_LOCAL_SHOW: {
        final DialogHighScoresLocalShowListener DIALOG_LISTENER_HIGH_SCORES_SHOW = new DialogHighScoresLocalShowListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("blank");
        builder.setTitle(R.string.LOCAL_HIGH_SCORES);
        builder.setNegativeButton(R.string.reset, DIALOG_LISTENER_HIGH_SCORES_SHOW);
        builder.setNeutralButton(android.R.string.ok, DIALOG_LISTENER_HIGH_SCORES_SHOW);
        builder.setPositiveButton(R.string.GLOBAL, DIALOG_LISTENER_HIGH_SCORES_SHOW);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_GAME_NEW: {
        final DialogGameNewListener DIALOG_LISTENER_GAME_NEW = new DialogGameNewListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(this.getString(R.string.game_over));
        builder.setPositiveButton(R.string.new_game, DIALOG_LISTENER_GAME_NEW);
        builder.setNeutralButton(R.string.REPLAY, DIALOG_LISTENER_GAME_NEW);
        builder.setNegativeButton(android.R.string.cancel, DIALOG_LISTENER_GAME_NEW);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_INTRO_INPUT_TYPE: {
        final DialogIntroListener DIALOG_LISTENER_INTRO = new DialogIntroListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.INTRO);
        builder.setPositiveButton(R.string.tap, DIALOG_LISTENER_INTRO);
        builder.setNeutralButton(android.R.string.cancel, DIALOG_LISTENER_INTRO);
        builder.setNegativeButton(R.string.drag, DIALOG_LISTENER_INTRO);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_INTRO_DONATE: {
        final DialogInterface.OnClickListener LISTENER = new DialogIntroDonateListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.INTRO_DONATE_MSG);
        builder.setPositiveButton(R.string.DONATE, LISTENER);
        builder.setNegativeButton(R.string.DONATE_NO, LISTENER);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_DONATE: {
        final DialogInterface.OnClickListener LISTENER = new DialogDonateListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.DONATE_MSG);
        builder.setPositiveButton(R.string.DONATE_MARKET, LISTENER);
        builder.setNeutralButton(R.string.DONATE_WEB, LISTENER);
        builder.setNegativeButton(R.string.DONATE_NO, LISTENER);
        dialog = builder.create();
        break;
    }
    default:
        dialog = super.onCreateDialog(id);
        break;
    }
    return dialog;
}

From source file:ws.crandell.newspaperpuzzles.wordsearch.view.WordSearchActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog;/*from  w w  w.j  a va  2  s. co  m*/
    switch (id) {
    case DIALOG_ID_NO_WORDS: {
        final DialogNoWordsListener DIALOG_LISTENER_NO_WORDS = new DialogNoWordsListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.ws_no_words);
        builder.setNegativeButton(R.string.ws_category, DIALOG_LISTENER_NO_WORDS);
        builder.setPositiveButton(R.string.ws_new_game, DIALOG_LISTENER_NO_WORDS);
        builder.setNeutralButton(R.string.ws_size, DIALOG_LISTENER_NO_WORDS);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_NO_WORDS_CUSTOM: {
        final DialogNoWordsCustomListener DIALOG_LISTENER_NO_WORDS_CUSTOM = new DialogNoWordsCustomListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.ws_no_words_custom);
        builder.setNegativeButton(R.string.ws_category, DIALOG_LISTENER_NO_WORDS_CUSTOM);
        builder.setPositiveButton(R.string.ws_custom_editor, DIALOG_LISTENER_NO_WORDS_CUSTOM);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_GAME_OVER: {
        final DialogGameOverListener DIALOG_LISTENER_GAME_OVER = new DialogGameOverListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("blank");
        EditText text = new EditText(this);
        text.setSingleLine();
        text.setId(android.R.id.input);
        builder.setView(text);
        builder.setPositiveButton(R.string.ws_SAVE_SUBMIT, DIALOG_LISTENER_GAME_OVER);
        builder.setNeutralButton(R.string.ws_SAVE, DIALOG_LISTENER_GAME_OVER);
        builder.setOnCancelListener(DIALOG_LISTENER_GAME_OVER);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_HIGH_SCORES_LOCAL_SHOW: {
        final DialogHighScoresLocalShowListener DIALOG_LISTENER_HIGH_SCORES_SHOW = new DialogHighScoresLocalShowListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("blank");
        builder.setTitle(R.string.ws_LOCAL_HIGH_SCORES);
        builder.setNegativeButton(R.string.ws_reset, DIALOG_LISTENER_HIGH_SCORES_SHOW);
        builder.setNeutralButton(android.R.string.ok, DIALOG_LISTENER_HIGH_SCORES_SHOW);
        builder.setPositiveButton(R.string.ws_GLOBAL, DIALOG_LISTENER_HIGH_SCORES_SHOW);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_GAME_NEW: {
        final DialogGameNewListener DIALOG_LISTENER_GAME_NEW = new DialogGameNewListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(this.getString(R.string.ws_game_over));
        builder.setPositiveButton(R.string.ws_new_game, DIALOG_LISTENER_GAME_NEW);
        builder.setNeutralButton(R.string.ws_REPLAY, DIALOG_LISTENER_GAME_NEW);
        builder.setNegativeButton(android.R.string.cancel, DIALOG_LISTENER_GAME_NEW);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_INTRO_INPUT_TYPE: {
        final DialogIntroListener DIALOG_LISTENER_INTRO = new DialogIntroListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.ws_INTRO);
        builder.setPositiveButton(R.string.ws_tap, DIALOG_LISTENER_INTRO);
        builder.setNeutralButton(android.R.string.cancel, DIALOG_LISTENER_INTRO);
        builder.setNegativeButton(R.string.ws_drag, DIALOG_LISTENER_INTRO);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_INTRO_DONATE: {
        final DialogInterface.OnClickListener LISTENER = new DialogIntroDonateListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.ws_INTRO_DONATE_MSG);
        builder.setPositiveButton(R.string.ws_DONATE, LISTENER);
        builder.setNegativeButton(R.string.ws_DONATE_NO, LISTENER);
        dialog = builder.create();
        break;
    }
    case DIALOG_ID_DONATE: {
        final DialogInterface.OnClickListener LISTENER = new DialogDonateListener();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.ws_DONATE_MSG);
        builder.setPositiveButton(R.string.ws_DONATE_MARKET, LISTENER);
        builder.setNeutralButton(R.string.ws_DONATE_WEB, LISTENER);
        builder.setNegativeButton(R.string.ws_DONATE_NO, LISTENER);
        dialog = builder.create();
        break;
    }
    default:
        dialog = super.onCreateDialog(id);
        break;
    }
    return dialog;
}