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:com.newtifry.android.SourceList.java

/**
 * Helper function to show a dialog to ask for a source name.
 *//*  w  ww  .  jav a2 s .c o  m*/
private void askForSourceName() {
    final EditText input = new EditText(this);

    new AlertDialog.Builder(this).setTitle(getString(R.string.create_source))
            .setMessage(getString(R.string.create_source_message)).setView(input)
            .setPositiveButton(getString(R.string.create), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    Editable value = input.getText();
                    if (value.length() > 0) {
                        // Fire it off to the create source function.
                        createSource(value.toString());
                    }
                }
            }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    // No need to take any action.
                }
            }).show();
}

From source file:fm.smart.r1.activity.CreateExampleActivity.java

public void onClick(View v) {
    EditText exampleInput = (EditText) findViewById(R.id.create_example_sentence);
    EditText translationInput = (EditText) findViewById(R.id.create_example_translation);
    EditText exampleTransliterationInput = (EditText) findViewById(R.id.sentence_transliteration);
    EditText translationTransliterationInput = (EditText) findViewById(R.id.translation_transliteration);
    final String example = exampleInput.getText().toString();
    final String translation = translationInput.getText().toString();
    if (TextUtils.isEmpty(example) || TextUtils.isEmpty(translation)) {
        Toast t = Toast.makeText(this, "Example and translation are required fields", 150);
        t.setGravity(Gravity.CENTER, 0, 0);
        t.show();/*  w w w. ja v a 2  s  .  co  m*/
    } else {
        final String example_language_code = Utils.LANGUAGE_MAP.get(example_language);
        final String translation_language_code = Utils.LANGUAGE_MAP.get(translation_language);
        final String example_transliteration = exampleTransliterationInput.getText().toString();
        final String translation_transliteration = translationTransliterationInput.getText().toString();

        if (Main.isNotLoggedIn(this)) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setClassName(this, LoginActivity.class.getName());
            intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // avoid
            // navigation
            // back to this?
            LoginActivity.return_to = CreateExampleActivity.class.getName();
            LoginActivity.params = new HashMap<String, String>();
            LoginActivity.params.put("list_id", list_id);
            LoginActivity.params.put("item_id", item_id);
            LoginActivity.params.put("example", example);
            LoginActivity.params.put("translation", translation);
            LoginActivity.params.put("example_language", example_language);
            LoginActivity.params.put("translation_language", translation_language);
            LoginActivity.params.put("example_transliteration", example_transliteration);
            LoginActivity.params.put("translation_transliteration", translation_transliteration);
            startActivity(intent);
        } else {

            final ProgressDialog myOtherProgressDialog = new ProgressDialog(this);
            myOtherProgressDialog.setTitle("Please Wait ...");
            myOtherProgressDialog.setMessage("Creating Example ...");
            myOtherProgressDialog.setIndeterminate(true);
            myOtherProgressDialog.setCancelable(true);

            final Thread create_example = new Thread() {
                public void run() {
                    // TODO make this interruptable .../*if
                    // (!this.isInterrupted())*/
                    try {
                        // TODO failures here could derail all ...
                        CreateExampleActivity.add_item_list_result = ItemActivity.addItemToList(list_id,
                                item_id, CreateExampleActivity.this);
                        CreateExampleActivity.create_example_result = createExample(example,
                                example_language_code, example_transliteration, translation,
                                translation_language_code, translation_transliteration, item_id, list_id);
                        CreateExampleActivity.add_sentence_list_result = ItemActivity.addSentenceToList(
                                CreateExampleActivity.create_example_result.http_response, item_id, list_id,
                                CreateExampleActivity.this);
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                    myOtherProgressDialog.dismiss();

                }
            };
            myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    create_example.interrupt();
                }
            });
            OnCancelListener ocl = new OnCancelListener() {
                public void onCancel(DialogInterface arg0) {
                    create_example.interrupt();
                }
            };
            myOtherProgressDialog.setOnCancelListener(ocl);
            myOtherProgressDialog.show();
            create_example.start();
        }
    }
}

From source file:fr.cph.stock.android.activity.OverallActivity.java

private void showPanelUpdateHistory() {
    final Dialog alert = new Dialog(this);
    alert.setTitle("Update history");
    alert.setContentView(R.layout.history_dialog);

    final Spinner checked = (Spinner) alert.findViewById(R.id.accountList);
    List<String> list = new ArrayList<String>();
    for (Account acc : portfolio.getAccounts()) {
        list.add(acc.getName());/*from ww w .j av a  2s .c  o m*/
    }
    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            list);
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    checked.setAdapter(dataAdapter);

    Button dialogButton = (Button) alert.findViewById(R.id.dialogButtonOK);
    dialogButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            refreshItem.setActionView(R.layout.progressbar);
            refreshItem.expandActionView();
            Account account = portfolio.getAccounts().get(checked.getSelectedItemPosition());
            EditText liquidityView = (EditText) alert.findViewById(R.id.liquidityMov);
            EditText yieldView = (EditText) alert.findViewById(R.id.yield);
            EditText buyView = (EditText) alert.findViewById(R.id.buy);
            EditText sellView = (EditText) alert.findViewById(R.id.sell);
            EditText taxeView = (EditText) alert.findViewById(R.id.taxe);
            EditText commentaryView = (EditText) alert.findViewById(R.id.commentaryEditText);

            String params = null;
            params = "?accountId=" + account.getId() + "&liquidity=" + liquidityView.getText() + "&yield="
                    + yieldView.getText() + "&buy=" + buyView.getText() + "&sell=" + sellView.getText()
                    + "&taxe=" + taxeView.getText() + "&commentary="
                    + commentaryView.getText().toString().replaceAll(" ", "%20");
            MainTask mainTask = new MainTask(OverallActivity.this, UrlType.UPDATEHISTORY, params);
            mainTask.execute((Void) null);
            alert.dismiss();
        }
    });
    dialogButton = (Button) alert.findViewById(R.id.dialogButtonCancel);
    dialogButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            alert.dismiss();
        }
    });
    alert.show();
}

From source file:com.otaupdater.utils.UserUtils.java

public static void showLoginDialog(final Context ctx, String defUsername, final DialogCallback dlgCallback,
        final LoginCallback loginCallback) {
    @SuppressLint("InflateParams")
    View view = LayoutInflater.from(ctx).inflate(R.layout.login_dialog, null);
    if (view == null)
        return;//from   w w  w  .  j a  v a 2  s .  c  o  m
    final EditText inputUsername = (EditText) view.findViewById(R.id.auth_username);
    final EditText inputPassword = (EditText) view.findViewById(R.id.auth_password);

    if (defUsername != null)
        inputUsername.setText(defUsername);

    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
    builder.setTitle(R.string.alert_login_title);
    builder.setView(view);
    builder.setPositiveButton(R.string.login, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            /* set below */ }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            if (loginCallback != null)
                loginCallback.onCancel();
        }
    });

    final AlertDialog dlg = builder.create();
    dlg.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            if (dlgCallback != null)
                dlgCallback.onDialogShown(dlg);
            Button button = dlg.getButton(DialogInterface.BUTTON_POSITIVE);
            if (button == null)
                return;
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    final String username = inputUsername.getText().toString();
                    final String password = inputPassword.getText().toString();

                    if (username.length() == 0 || password.length() == 0) {
                        Toast.makeText(ctx, R.string.toast_blank_userpass_error, Toast.LENGTH_LONG).show();
                        return;
                    }

                    dlg.dismiss();

                    APIUtils.userLogin(ctx, username, password, new APIUtils.ProgressDialogAPICallback(ctx,
                            ctx.getString(R.string.alert_logging_in), dlgCallback) {
                        @Override
                        public void onSuccess(String message, JSONObject respObj) {
                            try {
                                String realUsername = respObj.getString("username");
                                String hmacKey = respObj.getString("key");
                                Config.getInstance(ctx).storeLogin(realUsername, hmacKey);
                                if (loginCallback != null)
                                    loginCallback.onLoggedIn(realUsername);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onError(String message, JSONObject respObj) {
                            //TODO show some error
                        }
                    });
                }
            });
        }
    });
    dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            if (dlgCallback != null)
                dlgCallback.onDialogClosed(dlg);
        }
    });
    dlg.show();
}

From source file:cc.siara.csv_ml_demo.MainActivity.java

/**
 * Evaluates given XPath from Input box against Document generated by
 * parsing csv_ml in input box and sets value or node list to output box.
 *///www . j  ava 2  s.  com
void processXPath() {
    EditText etInput = (EditText) findViewById(R.id.etInput);
    EditText etXPath = (EditText) findViewById(R.id.etXPath);
    CheckBox cbPretty = (CheckBox) findViewById(R.id.cbPretty);
    XPath xpath = XPathFactory.newInstance().newXPath();
    MultiLevelCSVParser parser = new MultiLevelCSVParser();
    Document doc = null;
    try {
        doc = parser.parseToDOM(new StringReader(etInput.getText().toString()), false);
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    if (doc == null)
        return;
    StringBuffer out_str = new StringBuffer();
    try {
        XPathExpression expr = xpath.compile(etXPath.getText().toString());
        try {
            Document outDoc = Util.parseXMLToDOM("<output></output>");
            Element rootElement = outDoc.getDocumentElement();
            NodeList ret = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
            for (int i = 0; i < ret.getLength(); i++) {
                Object o = ret.item(i);
                if (o instanceof String) {
                    out_str.append(o);
                } else if (o instanceof Node) {
                    Node n = (Node) o;
                    short nt = n.getNodeType();
                    switch (nt) {
                    case Node.TEXT_NODE:
                    case Node.ATTRIBUTE_NODE:
                    case Node.CDATA_SECTION_NODE: // Only one value gets
                                                  // evaluated?
                        if (out_str.length() > 0)
                            out_str.append(',');
                        if (nt == Node.ATTRIBUTE_NODE)
                            out_str.append(n.getNodeValue());
                        else
                            out_str.append(n.getTextContent());
                        break;
                    case Node.ELEMENT_NODE:
                        rootElement.appendChild(outDoc.importNode(n, true));
                        break;
                    }
                }
            }
            if (out_str.length() > 0) {
                rootElement.setTextContent(out_str.toString());
                out_str.setLength(0);
            }
            out_str.append(Util.docToString(outDoc, true));
        } catch (Exception e) {
            // Thrown most likely because the given XPath evaluates to a
            // string
            out_str.append(expr.evaluate(doc));
        }
    } catch (XPathExpressionException e) {
        e.printStackTrace();
    }
    if (out_str.length() > 5 && out_str.substring(0, 5).equals("<?xml"))
        out_str.delete(0, out_str.indexOf(">") + 1);
    EditText etOutput = (EditText) findViewById(R.id.etOutput);
    etOutput.setText(out_str.toString());
    // tfOutputSize.setText(String.valueOf(xmlString.length()));
}

From source file:com.example.android.wifidirect.DeviceDetailFragment.java

@Override
public void onConnectionInfoAvailable(final WifiP2pInfo info) {
    if (progressDialog != null && progressDialog.isShowing()) {
        progressDialog.dismiss();//from   ww w. j  a  v a  2s . c o  m
    }
    this.info = info;
    this.getView().setVisibility(View.VISIBLE);

    // The owner IP is now known.
    TextView view = (TextView) mContentView.findViewById(R.id.group_owner);
    view.setText(getResources().getString(R.string.group_owner_text)
            + ((info.isGroupOwner == true) ? getResources().getString(R.string.yes)
                    : getResources().getString(R.string.no)));

    // InetAddress from WifiP2pInfo struct.
    view = (TextView) mContentView.findViewById(R.id.device_info);
    view.setText("Group Owner IP - " + info.groupOwnerAddress.getHostAddress());

    // After the group negotiation, we assign the group owner as the file
    // server. The file server is single threaded, single connection server
    // socket.
    if (info.groupFormed && info.isGroupOwner) {
        new FileServerAsyncTask(getActivity(), mContentView.findViewById(R.id.status_text)).execute();
    } else if (info.groupFormed) {
        // The other device acts as the client. In this case, we enable the
        // get file button.
        mContentView.findViewById(R.id.btn_start_client).setVisibility(View.VISIBLE);
        ((TextView) mContentView.findViewById(R.id.status_text))
                .setText(getResources().getString(R.string.client_text));
        mContentView.findViewById(R.id.details_layout).setVisibility(View.VISIBLE);
        mContentView.findViewById(R.id.btn_send_data).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // Allow user to pick an image from Gallery or other
                // registered apps

                TextView statusText = (TextView) mContentView.findViewById(R.id.status_text);
                EditText mName = (EditText) mContentView.findViewById(R.id.nameField);
                EditText mAddress = (EditText) mContentView.findViewById(R.id.addressField);
                EditText mAge = (EditText) mContentView.findViewById(R.id.ageField);
                EditText mMessage = (EditText) mContentView.findViewById(R.id.messageField);
                String name = mName.getText().toString();
                String address = mAddress.getText().toString();
                String age = mAge.getText().toString();
                String message = mMessage.getText().toString();
                JSONObject data_object = new JSONObject();
                try {
                    data_object.put("name", name);
                    data_object.put("address", address);
                    data_object.put("age", age);
                    data_object.put("message", message);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                statusText.setText("Sending: " + data_object.toString());
                Log.d(WiFiDirectActivity.TAG, "Intent----------- " + data_object.toString());
                Intent serviceIntent = new Intent(getActivity(), FileTransferService.class);
                serviceIntent.setAction(FileTransferService.ACTION_SEND_DATA);
                serviceIntent.putExtra(FileTransferService.EXTRAS_DATA, data_object.toString());
                serviceIntent.putExtra(FileTransferService.EXTRAS_GROUP_OWNER_ADDRESS,
                        info.groupOwnerAddress.getHostAddress());
                serviceIntent.putExtra(FileTransferService.EXTRAS_GROUP_OWNER_PORT, 8988);
                getActivity().startService(serviceIntent);

            }
        });
    }

    // hide the connect button
    mContentView.findViewById(R.id.btn_connect).setVisibility(View.GONE);
}

From source file:no.ntnu.idi.socialhitchhiking.map.MapActivityJourney.java

/**
 * sends a message to the driver of a journey
 *//*from   w ww . j av a 2s .  c o m*/
private void sendMessageToDriver() {

    final Dialog customDialog = new Dialog(this);
    customDialog.setContentView(R.layout.custom_dialog_layout);
    customDialog.setTitle("Message");

    final List<String> spinnerArray = new ArrayList<String>();
    spinnerArray.add("Everyone");
    if (!getApp().getSelectedJourney().getDriver().equals(getApp().getUser())) {
        spinnerArray.add(getApp().getSelectedJourney().getDriver().getFullName());
    }

    for (int i = 0; i < getApp().getSelectedJourney().getHitchhikers().size(); i++) {
        if (!getApp().getSelectedJourney().getHitchhikers().get(i).equals(getApp().getUser())) {
            spinnerArray.add(getApp().getSelectedJourney().getHitchhikers().get(i).getFullName());
        }
    }

    final Spinner spinner = (Spinner) customDialog.findViewById(R.id.spinner);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(MapActivityJourney.this,
            android.R.layout.simple_spinner_item, spinnerArray);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

    ImageView sendBtn = (ImageView) customDialog.findViewById(R.id.sendBtn);
    final EditText input = (EditText) customDialog.findViewById(R.id.input);

    sendBtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            User mid = getApp().getUser();
            if (spinner.getSelectedItem().toString().equals("Everyone")) {
                if (input.getText().toString().equals("")) {
                    input.setHint("Please fill in your message");
                    Toast toast = Toast.makeText(MapActivityJourney.this, "Please fill in your message",
                            Toast.LENGTH_SHORT);
                    toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2);
                    toast.show();
                } else {
                    List<User> userList = new ArrayList<User>();
                    userList.add(getApp().getSelectedJourney().getDriver());
                    for (int k = 0; k < getApp().getSelectedJourney().getHitchhikers().size(); k++) {
                        userList.add(getApp().getSelectedJourney().getHitchhikers().get(k));
                    }
                    userList.remove(getApp().getUser());

                    for (int k = 0; k < userList.size(); k++) {
                        sendMessage(userList.get(k), input);
                    }

                    Toast toast = Toast.makeText(MapActivityJourney.this, "Message sent", Toast.LENGTH_SHORT);
                    toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2);
                    toast.show();
                    customDialog.dismiss();
                }
            } else {

                for (int j = 0; j < getApp().getSelectedJourney().getHitchhikers().size(); j++) {
                    if (spinner.getSelectedItem().toString()
                            .equals(getApp().getSelectedJourney().getHitchhikers().get(j).getFullName())) {
                        mid = getApp().getSelectedJourney().getHitchhikers().get(j);
                    }
                }

                if (spinner.getSelectedItem().toString()
                        .equals(getApp().getSelectedJourney().getDriver().getFullName())) {
                    mid = getApp().getSelectedJourney().getDriver();
                }
                if (input.getText().toString().equals("")) {
                    input.setHint("Please fill in your message");
                    Toast toast = Toast.makeText(MapActivityJourney.this, "Please fill in your message",
                            Toast.LENGTH_SHORT);
                    toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2);
                    toast.show();
                } else {
                    sendMessage(mid, input);
                    Toast toast = Toast.makeText(MapActivityJourney.this, "Message sent", Toast.LENGTH_SHORT);
                    toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2);
                    toast.show();
                    customDialog.dismiss();
                }

            }

        }

    });

    customDialog.show();

}

From source file:eu.codeplumbers.cosi.wizards.firstrun.ConnectFragment.java

private void showGiveDevicePasswordDialog() {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle("Register your device");
    alertDialog.setMessage("Your device is already registered\n Please type your device token");

    final EditText input = new EditText(getActivity());

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    input.setLayoutParams(lp);// w  w w  .  ja  v a  2  s .com
    alertDialog.setView(input);

    alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            String password = input.getText().toString();

            if (!password.isEmpty()) {
                final JSONObject permissionJson = new JSONObject();
                final JSONObject desc = new JSONObject();
                try {
                    Device device = new Device();
                    device.setUrl(mUrl.getText().toString());
                    device.setLogin(mDeviceName.getText().toString());
                    device.setPassword(password);

                    desc.put("description", "sync all my cozy data");
                    permissionJson.put("All", desc);

                    device.setPermissions(permissionJson.toString());
                    device.setFirstSyncDone(false);
                    device.setSyncCalls(false);
                    device.setSyncContacts(false);
                    device.setSyncFiles(false);
                    device.setSyncNotes(false);

                    device.save();

                    onRegisterSuccess(device);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            } else {
                input.setError("Your device token can not be empty!");
            }
        }
    });
    alertDialog.show();
}

From source file:gov.in.bloomington.georeporter.fragments.PersonalInfoFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    final String fieldname = PersonalInfoAdapter.FIELDS[position];
    final TextView label = (TextView) v.findViewById(android.R.id.text1);
    final TextView input = (TextView) v.findViewById(android.R.id.text2);

    final EditText newValue = new EditText(getActivity());
    newValue.setText(input.getText());/*from www  .  j a  va2  s.co m*/

    int type = InputType.TYPE_TEXT_FLAG_CAP_WORDS;
    if (fieldname == "email") {
        type = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
    }
    if (fieldname == "phone") {
        type = InputType.TYPE_CLASS_PHONE;
    }
    newValue.setInputType(type);

    new AlertDialog.Builder(getActivity()).setTitle(label.getText()).setView(newValue)
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    try {
                        mPersonalInfo.put(fieldname, newValue.getText());
                    } catch (JSONException e) {
                        // Just ignore any errors
                    }
                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // Do Nothing
                }
            }).show();
}

From source file:com.rainmakerlabs.bleepsample.BleepService.java

private void processTypeLaunch(final String intentAction, final String intentUri, final String intentType,
        final String intentExtras, final String cfmMsg, String failMsgTemp, final int notifyId) {

    //if you wish, use a default generic fail message whenever undefined. recommended to use this when testing
    if (failMsgTemp.equalsIgnoreCase(""))
        failMsgTemp = "Opening URL failed!";
    final String failMsg = failMsgTemp;

    Pattern pattern = Pattern.compile("\\[ASK:(.*?)\\]");
    final Matcher matcher = pattern.matcher(intentUri);
    int count = 0;
    String askMsg = "";
    while (matcher.find()) {
        count++;//  w w w  . j  av a2s .c  om
        askMsg = matcher.group(1);
    }
    if (count == 1) {
        //confirm alert with text input
        if (BleepActivity.isBackground)
            localNotification("", cfmMsg, notifyId);
        final EditText input = new EditText(BleepActivity.currentBleepActivity);
        DialogInterface.OnClickListener posFunc = new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                String userInput = input.getText().toString();
                String intentUri2 = matcher.replaceFirst(userInput);
                Intent launchIntent = createIntent(intentAction, intentUri2, intentType, intentExtras);
                startIntent(launchIntent, failMsg, true, cfmMsg, notifyId);
            }
        };
        DialogInterface.OnClickListener negFunc = new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                // Do nothing.
            }
        };
        showAlertDialog(cfmMsg, askMsg, "OK", posFunc, "Cancel", negFunc, input);
    } else if (!cfmMsg.equalsIgnoreCase("")) {
        //confirm alert, message only, no text input
        final Intent launchIntent = createIntent(intentAction, intentUri, intentType, intentExtras);
        if (!BleepActivity.isTesting && !testIntent(launchIntent)) {
            return;
        }
        if (BleepActivity.isBackground) {
            localNotification("", cfmMsg, launchIntent, failMsg, notifyId);
        } else {
            DialogInterface.OnClickListener posFunc = new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    startIntent(launchIntent, failMsg, true, cfmMsg, notifyId);
                }
            };
            DialogInterface.OnClickListener negFunc = new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    // Do nothing.
                }
            };
            showAlertDialog("", cfmMsg, "OK", posFunc, "Cancel", negFunc, null);
        }
    } else {
        //no confirm alert
        Intent launchIntent = createIntent(intentAction, intentUri, intentType, intentExtras);
        if (!BleepActivity.isTesting && !testIntent(launchIntent)) {
            return;
        }
        String tmpCfmMsg = "You have been sent a URL to view. Open?";
        if (BleepActivity.isBackground) {
            localNotification("", tmpCfmMsg, launchIntent, failMsg, notifyId);
        } else {
            startIntent(launchIntent, failMsg, true, tmpCfmMsg, notifyId);
        }
    }
}