Example usage for android.widget EditText getText

List of usage examples for android.widget EditText getText

Introduction

In this page you can find the example usage for android.widget EditText getText.

Prototype

@Override
    public Editable getText() 

Source Link

Usage

From source file:br.com.thinkti.android.filechooserfrag.fragFileChooser.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    View v = info.targetView;/*from   w  ww.jav a 2  s .c  o m*/
    final Option o = adapter.getItem((int) info.id);
    switch (item.getItemId()) {
    case R.id.mnuDelete:
        String msg = String.format(getString(R.string.txtReallyDelete), o.getName());
        if (lib.ShowMessageYesNo(_main, msg, _main.getString(R.string.question)) == lib.yesnoundefined.yes) {
            try {
                File F = new File(o.getPath());
                boolean delete = false;
                if (F.exists()) {
                    if (F.isDirectory()) {
                        String[] deleteCmd = { "rm", "-r", F.getPath() };
                        Runtime runtime = Runtime.getRuntime();
                        runtime.exec(deleteCmd);
                        delete = true;
                    } else {
                        delete = F.delete();
                    }
                }

                if (delete)
                    adapter.remove(o);

            } catch (Exception ex) {
                lib.ShowMessage(_main, ex.getMessage(), getString((R.string.Error)));
            }
        }
        //lib.ShowToast(_main,"delete " + t1.getText().toString() + " " + t2.getText().toString() + " " + o.getData() + " "  + o.getPath() + " " + o.getName());
        //editNote(info.id);
        return true;
    case R.id.mnuRename:
        String msg2 = String.format(getString(R.string.txtRenameFile), o.getName());
        AlertDialog.Builder A = new AlertDialog.Builder(_main);
        final EditText inputRename = new EditText(_main);
        A.setMessage(msg2);
        A.setTitle(getString(R.string.rename));

        // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
        inputRename.setInputType(InputType.TYPE_CLASS_TEXT);
        inputRename.setText(o.getName());
        A.setView(inputRename);
        A.setPositiveButton(_main.getString(R.string.ok), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                String name = inputRename.getText().toString();
                final String pattern = ".+\\.(((?i)v.{2})|((?i)k.{2})|((?i)dic))$";
                Pattern vok = Pattern.compile(pattern);
                if (lib.libString.IsNullOrEmpty(name))
                    return;
                if (vok.matcher(name).matches()) {
                    try {

                        File F = new File(o.getPath());
                        File F2 = new File(F.getParent(), name);
                        if (!F2.exists()) {
                            final boolean b = F.renameTo(F2);
                            if (b) {
                                o.setName(name);
                                o.setPath(F2.getPath());
                                adapter.notifyDataSetChanged();
                            }
                        } else {
                            lib.ShowMessage(_main, getString(R.string.msgFileExists), "");
                        }

                    } catch (Exception ex) {
                        lib.ShowMessage(_main, ex.getMessage(), getString((R.string.Error)));
                    }
                } else {
                    AlertDialog.Builder A = new AlertDialog.Builder(_main);
                    A.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {

                        }
                    });
                    A.setMessage(getString(R.string.msgWrongExt2));
                    A.setTitle(getString(R.string.message));
                    AlertDialog dlg = A.create();
                    dlg.show();

                }
            }
        });
        A.setNegativeButton(_main.getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        AlertDialog dlg = A.create();
        dlg.show();
        return true;
    case R.id.mnuCopy:
        _copiedFile = (o.getPath());
        _cutFile = null;
        return true;
    case R.id.mnuCut:
        _cutFile = (o.getPath());
        _cutOption = o;
        _copiedFile = null;
        return true;
    case R.id.mnuPaste:
        if (_cutFile != null && _copiedFile != null)
            return true;
        String path;
        File F = new File(o.getPath());
        if (F.isDirectory()) {
            path = F.getPath();
        } else {
            path = F.getParent();
        }
        if (_copiedFile != null) {
            File source = new File(_copiedFile);
            File dest = new File(path, source.getName());
            if (dest.exists()) {
                lib.ShowMessage(_main, getString(R.string.msgFileExists), "");
                return true;
            }
            String[] copyCmd;
            if (source.isDirectory()) {
                copyCmd = new String[] { "cp", "-r", _copiedFile, path };
            } else {
                copyCmd = new String[] { "cp", _copiedFile, path };
            }
            Runtime runtime = Runtime.getRuntime();
            try {
                runtime.exec(copyCmd);
                Option newOption;
                if (dest.getParent().equalsIgnoreCase(currentDir.getPath())) {
                    if (dest.isDirectory() && !dest.isHidden()) {
                        adapter.add(new Option(dest.getName(), getString(R.string.folder),
                                dest.getAbsolutePath(), true, false, false));
                    } else {
                        if (!dest.isHidden())
                            adapter.add(new Option(dest.getName(),
                                    getString(R.string.fileSize) + ": " + dest.length(), dest.getAbsolutePath(),
                                    false, false, false));
                    }
                }
            } catch (Exception ex) {
                lib.ShowMessage(_main, ex.getMessage(), getString((R.string.Error)));
            }

        } else if (_cutFile != null) {
            File source = new File(_cutFile);
            File dest = new File(path, source.getName());
            if (dest.exists()) {
                lib.ShowMessage(_main, getString(R.string.msgFileExists), "");
                return true;
            }
            String[] copyCmd;
            if (source.isDirectory()) {
                copyCmd = new String[] { "mv", "-r", _cutFile, path };
            } else {
                copyCmd = new String[] { "mv", _cutFile, path };
            }
            Runtime runtime = Runtime.getRuntime();
            _cutFile = null;
            try {
                runtime.exec(copyCmd);
                Option newOption;
                try {
                    adapter.remove(_cutOption);
                    _cutOption = null;
                } catch (Exception e) {

                }
                if (dest.getParent().equalsIgnoreCase(currentDir.getPath())) {
                    if (dest.isDirectory() && !dest.isHidden()) {
                        adapter.add(new Option(dest.getName(), getString(R.string.folder),
                                dest.getAbsolutePath(), true, false, false));
                    } else {
                        if (!dest.isHidden())
                            adapter.add(new Option(dest.getName(),
                                    getString(R.string.fileSize) + ": " + dest.length(), dest.getAbsolutePath(),
                                    false, false, false));
                    }
                }
            } catch (Exception ex) {
                lib.ShowMessage(_main, ex.getMessage(), getString((R.string.Error)));
            }
        }
        return true;
    case R.id.mnuNewFolder:
        A = new AlertDialog.Builder(_main);
        //final EditText input = new EditText(_main);
        final EditText inputNF = new EditText(_main);
        A.setMessage(getString(R.string.msgEnterNewFolderName));
        A.setTitle(getString(R.string.cmnuNewFolder));

        // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
        inputNF.setInputType(InputType.TYPE_CLASS_TEXT);
        inputNF.setText("");
        A.setView(inputNF);
        A.setPositiveButton(_main.getString(R.string.ok), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                String name = inputNF.getText().toString();
                if (lib.libString.IsNullOrEmpty(name))
                    return;
                String NFpath;
                File NF = new File(o.getPath());
                if (NF.isDirectory()) {
                    NFpath = NF.getPath();
                } else {
                    NFpath = NF.getParent();
                }
                try {
                    File NewFolder = new File(NFpath, name);
                    NewFolder.mkdir();
                    adapter.add(new Option(NewFolder.getName(), getString(R.string.folder),
                            NewFolder.getAbsolutePath(), true, false, false));

                } catch (Exception ex) {
                    lib.ShowException(_main, ex);
                }
            }
        });
        A.setNegativeButton(_main.getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        dlg = A.create();
        dlg.show();
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:com.duy.pascal.ui.file.fragment.FragmentFileManager.java

public void createNewFolder() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    builder.setTitle(R.string.new_folder);
    builder.setView(R.layout.dialog_new_file);
    final AlertDialog alertDialog = builder.create();
    alertDialog.show();//from  w  w  w  . j  av a2 s .com
    final EditText editText = alertDialog.findViewById(R.id.edit_input);
    final TextInputLayout textInputLayout = alertDialog.findViewById(R.id.hint);

    textInputLayout.setHint(getString(R.string.enter_new_folder_name));
    View btnOK = alertDialog.findViewById(R.id.btn_ok);
    View btnCancel = alertDialog.findViewById(R.id.btn_cancel);

    btnCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            alertDialog.cancel();
        }
    });

    btnOK.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //get string path of in edit text
            String fileName = editText != null ? editText.getText().toString() : null;
            if (fileName.isEmpty()) {
                editText.setError(getString(R.string.enter_new_file_name));
                return;
            }
            //create new file
            File file = new File(mCurrentFolder, fileName);
            file.mkdirs();
            new UpdateList(mCurrentFolder).execute();
            alertDialog.cancel();
        }
    });

}

From source file:ca.ualberta.cs.unter.view.RiderMainActivity.java

private void openRiderSendRequestDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(RiderMainActivity.this);
    LayoutInflater inflater = this.getLayoutInflater();
    View promptView = inflater.inflate(R.layout.rider_send_request_dialog, null);

    // Set the default fare
    final Request request = new PendingRequest(rider.getUserName(),
            new Route(departureLocation, destinationLocation));
    requestController.setDistance(request, distance); // set the distance before estimating fare
    requestController.calculateEstimatedFare(request);

    final EditText fareEditText = (EditText) promptView.findViewById(R.id.edittext_fare_ridermainactivity);
    final EditText descriptionEditText = (EditText) promptView
            .findViewById(R.id.edittext_description_ridermainactivity);
    fareEditText.setText(request.getRoundedFare()); // shows fare rounded to 2 dec places

    builder.setTitle("Send Request").setView(promptView)
            .setNegativeButton(R.string.dialog_cancel_button, new DialogInterface.OnClickListener() {
                @Override/*from   w  w  w. j  av  a2s  . c  o  m*/
                public void onClick(DialogInterface dialog, int id) {
                }
            }).setPositiveButton(R.string.dialog_send_request_button, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    // TODO send request to drivers
                    String description = descriptionEditText.getText().toString();
                    double fare = Double.parseDouble(fareEditText.getText().toString());
                    if (fare == 0) {
                        fareEditText.setError("Fare cannot be empty");
                    } else if (description.isEmpty()) {
                        descriptionEditText.setError("Description cannot be empty");
                    } else {
                        Route route = new Route(departureLocation, destinationLocation);
                        route.setDistance(distance);
                        Request req = new PendingRequest(rider.getUserName(), route);
                        req.setEstimatedFare(fare);
                        req.setRequestDescription(description);
                        req.setID(UUID.randomUUID().toString());
                        requestController.createRequest(req);
                        // clean up filed after it's done
                        searchDepartureLocationEditText.setText("");
                        searchDestinationLocationEditText.setText("");
                    }
                }
            });
    // Create & Show the AlertDialog
    AlertDialog dialog = builder.create();
    dialog.show();
}

From source file:fi.mikuz.boarder.gui.DropboxMenu.java

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_share:
        Thread thread = new Thread() {
            public void run() {
                Looper.prepare();/*from  w w  w . ja  v a2 s .c  o  m*/
                try {
                    final ArrayList<String> boards = mCbla.getAllSelectedTitles();
                    if (!(mOperation == DOWNLOAD_OPERATION)) {
                        mToastMessage = "Select 'Download' mode";
                        mHandler.post(mShowToast);
                    } else if (boards.size() < 1) {
                        mToastMessage = "Select boards to share";
                        mHandler.post(mShowToast);
                    } else {
                        String shareString = "I want to share some cool soundboards to you!\n\n"
                                + "To use the boards you need to have Boarder for Android:\n"
                                + ExternalIntent.mExtLinkMarket + "\n\n" + "Here are the boards:\n";

                        for (String board : boards) {
                            shareString += board + " - " + mApi.createCopyRef("/" + board).copyRef + "\n";
                        }

                        shareString += "\n\n" + "Importing a board:\n" + "1. Open Boarder'\n"
                                + "2. Open Dropbox from menu in 'Soundboard Menu'\n"
                                + "3. Open 'Import share' from menu\n"
                                + "4. Copy a reference from above to textfield\n";

                        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
                        sharingIntent.setType("text/plain");
                        sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sharing boards");
                        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareString);
                        startActivity(Intent.createChooser(sharingIntent, "Share via"));
                    }
                } catch (DropboxException e) {
                    Log.e(TAG, "Unable to share", e);
                }
            }
        };
        thread.start();
        return true;

    case R.id.menu_import_share:
        LayoutInflater removeInflater = (LayoutInflater) DropboxMenu.this
                .getSystemService(LAYOUT_INFLATER_SERVICE);
        View importLayout = removeInflater.inflate(R.layout.dropbox_menu_alert_import_share,
                (ViewGroup) findViewById(R.id.alert_remove_sound_root));

        AlertDialog.Builder importBuilder = new AlertDialog.Builder(DropboxMenu.this);
        importBuilder.setView(importLayout);
        importBuilder.setTitle("Import share");

        final EditText importCodeInput = (EditText) importLayout.findViewById(R.id.importCodeInput);
        final EditText importNameInput = (EditText) importLayout.findViewById(R.id.importNameInput);

        importBuilder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                t = new Thread() {
                    public void run() {
                        Looper.prepare();
                        try {
                            mApi.addFromCopyRef(importCodeInput.getText().toString(),
                                    "/" + importNameInput.getText().toString());
                            mToastMessage = "Download the board from 'Download'";
                            mHandler.post(mShowToast);
                        } catch (DropboxException e) {
                            Log.e(TAG, "Unable to get shared board", e);
                        }
                    }
                };
                t.start();
            }
        });

        importBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
            }
        });
        importBuilder.show();
        return true;
    }

    return super.onMenuItemSelected(featureId, item);
}

From source file:com.andrewshu.android.reddit.mail.InboxActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog;/*from w  w w .j a  va  2  s. c  o  m*/
    ProgressDialog pdialog;
    AlertDialog.Builder builder;
    LayoutInflater inflater;
    View layout; // used for inflated views for AlertDialog.Builder.setView()

    switch (id) {
    case Constants.DIALOG_COMPOSE:
        inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        layout = inflater.inflate(R.layout.compose_dialog, null);
        dialog = builder.setView(layout).create();
        final Dialog composeDialog = dialog;

        Common.setTextColorFromTheme(mSettings.getTheme(), getResources(),
                (TextView) layout.findViewById(R.id.compose_destination_textview),
                (TextView) layout.findViewById(R.id.compose_subject_textview),
                (TextView) layout.findViewById(R.id.compose_message_textview),
                (TextView) layout.findViewById(R.id.compose_captcha_textview),
                (TextView) layout.findViewById(R.id.compose_captcha_loading));

        final EditText composeDestination = (EditText) layout.findViewById(R.id.compose_destination_input);
        final EditText composeSubject = (EditText) layout.findViewById(R.id.compose_subject_input);
        final EditText composeText = (EditText) layout.findViewById(R.id.compose_text_input);
        final Button composeSendButton = (Button) layout.findViewById(R.id.compose_send_button);
        final Button composeCancelButton = (Button) layout.findViewById(R.id.compose_cancel_button);
        final EditText composeCaptcha = (EditText) layout.findViewById(R.id.compose_captcha_input);
        composeSendButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                ThingInfo thingInfo = new ThingInfo();

                if (!FormValidation.validateComposeMessageInputFields(InboxActivity.this, composeDestination,
                        composeSubject, composeText, composeCaptcha))
                    return;

                thingInfo.setDest(composeDestination.getText().toString().trim());
                thingInfo.setSubject(composeSubject.getText().toString().trim());
                new MyMessageComposeTask(composeDialog, thingInfo, composeCaptcha.getText().toString().trim(),
                        mCaptchaIden, mSettings, mClient, InboxActivity.this)
                                .execute(composeText.getText().toString().trim());
                removeDialog(Constants.DIALOG_COMPOSE);
            }
        });
        composeCancelButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                removeDialog(Constants.DIALOG_COMPOSE);
            }
        });
        break;

    case Constants.DIALOG_COMPOSING:
        pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        pdialog.setMessage("Composing message...");
        pdialog.setIndeterminate(true);
        pdialog.setCancelable(true);
        dialog = pdialog;
        break;
    default:
        throw new IllegalArgumentException("Unexpected dialog id " + id);
    }
    return dialog;
}

From source file:com.dvn.vindecoder.ui.user.GetAllVehicalDetails.java

public void openDialog() {

    // get prompts.xml view
    LayoutInflater li = LayoutInflater.from(GetAllVehicalDetails.this);
    View promptsView = li.inflate(R.layout.prompt, null);

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(GetAllVehicalDetails.this);

    // set prompts.xml to alertdialog builder
    alertDialogBuilder.setView(promptsView);
    alertDialogBuilder.setTitle("Why you want to stop this");
    final EditText userInput = (EditText) promptsView.findViewById(R.id.editTextDialogUserInput);

    // set dialog message
    alertDialogBuilder.setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // get user input and set it to result
            // edit text
            //result.setText(userInput.getText());
            if (!userInput.getText().toString().trim().isEmpty()) {
                reason = userInput.getText().toString().trim();
                getUserData(reason);//from   ww  w  .  j a  v a 2 s  . com
            } else {
                Toast.makeText(GetAllVehicalDetails.this, "Please fill your reason", Toast.LENGTH_LONG).show();
            }
        }
    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();

}

From source file:com.googlecode.CallerLookup.Main.java

public void doSave() {
    final Context context = this;
    final EditText input = new EditText(context);
    input.setHint(R.string.Name);

    AlertDialog.Builder alert = new AlertDialog.Builder(context);
    alert.setTitle(R.string.SaveTitle);/*from w w w.j  av a 2s. c om*/
    alert.setMessage(R.string.SaveMessage);
    alert.setView(input);

    alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @SuppressWarnings("unchecked")
        @Override
        public void onClick(DialogInterface dialog, int which) {
            final String name = SAVED_PREFIX + input.getText().toString().trim();
            if (name.length() <= SAVED_PREFIX.length()) {
                AlertDialog.Builder error = new AlertDialog.Builder(context);
                error.setTitle(R.string.NameMissingTitle);
                error.setMessage(R.string.NameMissingMessage);
                error.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        doSave();
                    }
                });
                error.show();
                return;
            }
            if (mLookupEntries.containsKey(name)) {
                AlertDialog.Builder confirm = new AlertDialog.Builder(context);
                confirm.setTitle(R.string.NameConfirmTitle);
                confirm.setMessage(R.string.NameConfirmMessage);
                confirm.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        mLookupEntries.remove(name);
                        mUserLookupEntries.remove(name);
                        addUserLookupEntry(name);

                        int count = mLookup.getCount();
                        for (int i = 1; i < count; i++) {
                            if (mLookup.getItemAtPosition(i).toString().equals(name)) {
                                mLookup.setSelection(i);
                                break;
                            }
                        }
                    }
                });
                confirm.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        doSave();
                    }
                });
                confirm.show();
                return;
            }

            addUserLookupEntry(name);

            ArrayAdapter<CharSequence> adapter = (ArrayAdapter<CharSequence>) mLookup.getAdapter();
            adapter.add(name);
            mLookup.setSelection(mLookup.getCount() - 1);
        }
    });

    alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });

    alert.show();
}

From source file:com.matthewmitchell.peercoin_android_wallet.ui.WalletActivity.java

private Dialog createBackupWalletDialog() {
    final View view = getLayoutInflater().inflate(R.layout.backup_wallet_dialog, null);
    final EditText passwordView = (EditText) view.findViewById(R.id.export_keys_dialog_password);

    final DialogBuilder dialog = new DialogBuilder(this);
    dialog.setTitle(R.string.export_keys_dialog_title);
    dialog.setView(view);//from ww w.  j a v a2  s .  c om
    dialog.setPositiveButton(R.string.export_keys_dialog_button_export, new OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            final String password = passwordView.getText().toString().trim();
            passwordView.setText(null); // get rid of it asap

            backupWallet(password);

            config.disarmBackupReminder();
        }
    });
    dialog.setNegativeButton(R.string.button_cancel, new OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            passwordView.setText(null); // get rid of it asap
        }
    });
    dialog.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(final DialogInterface dialog) {
            passwordView.setText(null); // get rid of it asap
        }
    });
    return dialog.create();
}

From source file:net.bytten.comicviewer.ComicViewerActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    // Set up variables for a dialog and a dialog builder. Only need one of each.
    Dialog dialog = null;/*from  w  w w  .  ja  v  a2  s. co m*/
    AlertDialog.Builder builder = null;

    // Determine the type of dialog based on the integer passed. These are defined in constants
    // at the top of the class.
    switch (id) {
    case DIALOG_SHOW_HOVER_TEXT:
        //Build and show the Hover Text dialog
        builder = new AlertDialog.Builder(ComicViewerActivity.this);
        builder.setMessage(comicInfo.getAlt());
        builder.setPositiveButton("Open Link...", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                openComicLink();
            }
        });
        builder.setNegativeButton("Close", null);
        dialog = builder.create();
        builder = null;
        break;
    case DIALOG_SHOW_ABOUT:
        //Build and show the About dialog
        builder = new AlertDialog.Builder(this);
        builder.setTitle(getStringAppName());
        builder.setIcon(android.R.drawable.ic_menu_info_details);
        builder.setNegativeButton(android.R.string.ok, null);
        builder.setNeutralButton("Donate", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                donate();
            }
        });
        builder.setPositiveButton("Developer Website", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                developerWebsite();
            }
        });
        View v = LayoutInflater.from(this).inflate(R.layout.about, null);
        TextView tv = (TextView) v.findViewById(R.id.aboutText);
        tv.setText(String.format(getStringAboutText(), getVersion()));
        builder.setView(v);
        dialog = builder.create();
        builder = null;
        v = null;
        tv = null;
        break;
    case DIALOG_SEARCH_BY_TITLE:
        //Build and show the Search By Title dialog
        builder = new AlertDialog.Builder(this);

        LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.search_dlg, (ViewGroup) findViewById(R.id.search_dlg));

        final EditText input = (EditText) layout.findViewById(R.id.search_dlg_edit_box);

        builder.setTitle("Search by Title");
        builder.setIcon(android.R.drawable.ic_menu_search);
        builder.setView(layout);
        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                String query = input.getText().toString();
                Uri uri = comicDef.getArchiveUrl();
                Intent i = new Intent(ComicViewerActivity.this, getArchiveActivityClass());
                i.setAction(Intent.ACTION_VIEW);
                i.setData(uri);
                i.putExtra(getPackageName() + "LoadType", ArchiveActivity.LoadType.SEARCH_TITLE);
                i.putExtra(getPackageName() + "query", query);
                startActivityForResult(i, PICK_ARCHIVE_ITEM);
            }
        });
        builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });
        dialog = builder.create();
        builder = null;
        break;
    case DIALOG_FAILED:
        // Probably doesn't need its own builder, but because this is a special case
        // dialog I gave it one.
        AlertDialog.Builder adb = new AlertDialog.Builder(this);
        adb.setTitle("Error");
        adb.setIcon(android.R.drawable.ic_dialog_alert);

        adb.setNeutralButton(android.R.string.ok, null);

        //Set failedDialog to our dialog so we can dismiss
        //it manually
        failedDialog = adb.create();
        failedDialog.setMessage(errors);

        dialog = failedDialog;
        break;
    default:
        dialog = null;
    }

    return dialog;
}