Example usage for android.app AlertDialog.Builder setView

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

Introduction

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

Prototype

public void setView(View view) 

Source Link

Document

Set the view to display in that dialog.

Usage

From source file:com.doomonafireball.hackerswiperfree.android.activity.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.get_hacker_swiper_pro:
        Intent hsProIntent = new Intent(Intent.ACTION_VIEW);
        hsProIntent.setData(Uri.parse(/*from   www.j ava  2s . c o  m*/
                "http://play.google.com/store/apps/details?id=com.doomonafireball.hackerswiperpro.android"));
        startActivity(hsProIntent);
        return true;
    case R.id.about:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.about_hacker_swiper);

        final TextView aboutText = new TextView(this);
        int padding = getResources().getDimensionPixelSize(R.dimen.default_padding);
        aboutText.setPadding(padding, padding, padding, padding);
        String appVersionName = "x.x";
        int appVersionCode = 0;
        try {
            appVersionName = getApplication().getPackageManager()
                    .getPackageInfo(getApplication().getPackageName(), 0).versionName;
            appVersionCode = getApplication().getPackageManager()
                    .getPackageInfo(getApplication().getPackageName(), 0).versionCode;

        } catch (PackageManager.NameNotFoundException e) {
            //Failed
        }
        aboutText.setText(Html.fromHtml(getString(R.string.about_hacker_swiper_text)));
        aboutText.append(
                String.format(getString(R.string.version_dynamic), appVersionName + " b" + appVersionCode));
        aboutText.append("\n");
        SpannableString openSourceLink = makeLinkSpan(getString(R.string.open_source_licenses),
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        showOpenSourceDialog();
                    }
                });
        aboutText.append(openSourceLink);
        aboutText.append("\n");
        aboutText.setFocusable(false);
        makeLinksFocusable(aboutText);

        builder.setView(aboutText);
        builder.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
        builder.show();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.citrus.sample.WalletPaymentFragment.java

private void showCvvPrompt(final PaymentOption paymentOption) {
    final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
    String message = "Please enter CVV.";
    String positiveButtonText = "OK";
    alert.setTitle("CVV");
    alert.setMessage(message);//  ww w .  java2 s.  c om
    // Set an EditText view to get user input
    final EditText input = new EditText(getActivity());
    input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    input.setTransformationMethod(PasswordTransformationMethod.getInstance());
    InputFilter[] FilterArray = new InputFilter[1];
    FilterArray[0] = new InputFilter.LengthFilter(4);
    input.setFilters(FilterArray);
    alert.setView(input);
    alert.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
            String cvv = input.getText().toString();
            input.clearFocus();
            // Hide the keyboard.
            InputMethodManager imm = (InputMethodManager) getActivity()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
            otherPaymentOption = paymentOption;
            ((CardOption) otherPaymentOption).setCardCVV(cvv);
        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            dialog.cancel();
            // Hide the keyboard.
            InputMethodManager imm = (InputMethodManager) getActivity()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
        }
    });

    input.requestFocus();
    alert.show();
}

From source file:com.devwang.logcabin.LogCabinMainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent serverIntent = null;/*from   ww  w  .  j av a  2  s  .  c  om*/
    Toast toast = Toast.makeText(LogCabinMainActivity.this, "", Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    switch (item.getItemId()) {
    case R.id.secure_connect_scan:// 
        // Launch the DeviceListActivity to see devices and do scan
        serverIntent = new Intent(this, DeviceListActivity.class);
        startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_SECURE);
        return true;
    case R.id.insecure_connect_scan:// 
        // Launch the DeviceListActivity to see devices and do scan
        serverIntent = new Intent(this, DeviceListActivity.class);
        startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_INSECURE);
        return true;
    case R.id.app_developer:
        toastDisplay(LogCabinMainActivity.this,
                ":   \n\nQQ:1120341494\n:dongleixiaxue314\n :http://www.devwang.com",
                Gravity.CENTER, R.drawable.hutview, Toast.LENGTH_SHORT);
        return true;
    case R.id.app_cmd_what:
    case R.id.app_voice_what:
        toast.setText(
                "\n\n\n\n...");
        toast.show();
        return true;
    case R.id.app_college:
        toast.setText(R.string.str_college);
        toast.show();
        return true;
    case R.id.app_web_url:
        toastDisplay(LogCabinMainActivity.this,
                getString(R.string.http_devwang_sinaapp_com_logcabin_logcabin_web_php), Gravity.CENTER, 0,
                Toast.LENGTH_SHORT);
        return true;
    case R.id.app_update:

        android.app.AlertDialog.Builder dialog = new AlertDialog.Builder(LogCabinMainActivity.this);
        LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialogview_appupdate, null);
        dialog.setView(layout);
        appUpdateEditText = (EditText) layout.findViewById(R.id.et_appupdate);
        dialog.setPositiveButton(R.string.str_app_update_sure, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                String appUpdateEditTextString = appUpdateEditText.getText().toString();
                if ("devwang".equals(appUpdateEditTextString.toString())) {
                    AppUpdate = true;
                    Toast.makeText(getApplicationContext(), R.string.str_app_update_pass_toast,
                            Toast.LENGTH_SHORT).show();
                }
            }
        });
        dialog.show();
        return true;
    }
    return false;
}

From source file:com.becapps.easydownloader.ShareActivity.java

private void showExtsdcardInfo() {
    generalInfoCheckboxEnabled = settings.getBoolean("extsdcard_info", true);
    if (generalInfoCheckboxEnabled == true) {
        AlertDialog.Builder adb = new AlertDialog.Builder(boxThemeContextWrapper);
        LayoutInflater adbInflater = LayoutInflater.from(ShareActivity.this);
        View generalInfo = adbInflater.inflate(R.layout.dialog_extsdcard_info, null);
        showAgain3 = (CheckBox) generalInfo.findViewById(R.id.showAgain3);
        showAgain3.setChecked(true);//w  w  w  . j a v a2 s.co  m
        adb.setView(generalInfo);
        adb.setTitle(getString(R.string.extsdcard_info_title));
        adb.setMessage(getString(R.string.extsdcard_info_msg));

        adb.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                if (showAgain3.isChecked() == false) {
                    settings.edit().putBoolean("extsdcard_info", false).commit();
                    sshInfoCheckboxEnabled = settings.getBoolean("extsdcard_info", true);
                    Utils.logger("d", "generalInfoCheckboxEnabled: " + generalInfoCheckboxEnabled, DEBUG_TAG);
                }
            }
        });
        if (!((Activity) ShareActivity.this).isFinishing()) {
            adb.show();
        }
    }
}

From source file:com.citrus.sample.WalletPaymentFragment.java

@OnClick(R.id.btnMasterpass)
public void testMasterPass() {

    final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
    String message = null;/*from ww  w  .  j av a2s .c  o m*/
    String positiveButtonText = null;
    message = "Please enter the transaction amount.";
    positiveButtonText = "Make Payment";

    LinearLayout linearLayout = new LinearLayout(getActivity());
    linearLayout.setOrientation(LinearLayout.VERTICAL);

    alert.setTitle("Transaction Amount?");
    alert.setMessage(message);
    // Set an EditText view to get user input
    final EditText input = new EditText(getActivity());
    input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    alert.setView(input);
    alert.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
            String value = input.getText().toString();
            input.clearFocus();
            // Hide the keyboard.
            InputMethodManager imm = (InputMethodManager) getActivity()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(input.getWindowToken(), 0);

            try {
                MasterPassOption masterPassOption = new MasterPassOption();
                PaymentType.PGPayment pgPayment = new PaymentType.PGPayment(new Amount(value),
                        Constants.BILL_URL, masterPassOption, null);
                mCitrusClient.simpliPay(pgPayment, new Callback<TransactionResponse>() {
                    @Override
                    public void success(TransactionResponse transactionResponse) {
                        Toast.makeText(getActivity(), transactionResponse.getMessage(), Toast.LENGTH_SHORT)
                                .show();
                    }

                    @Override
                    public void error(CitrusError error) {
                        Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });
            } catch (CitrusException e) {
                e.printStackTrace();
            }
        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            dialog.cancel();
        }
    });

    input.requestFocus();
    alert.show();
}

From source file:com.mediaexplorer.remote.MexRemoteActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/*  ww  w . j a v  a2s .  c  o m*/

    this.setTitle(R.string.app_name);
    dbg = "MexWebremote";

    text_view = (TextView) findViewById(R.id.text);

    web_view = (WebView) findViewById(R.id.link_view);
    web_view.getSettings().setJavaScriptEnabled(true);/*
                                                      /* Future: setOverScrollMode is API level >8
                                                      * web_view.setOverScrollMode (OVER_SCROLL_NEVER);
                                                      */

    web_view.setBackgroundColor(0);

    web_view.setWebViewClient(new WebViewClient() {
        /* for some reason we only get critical errors so an auth error
         * is not handled here which is why there is some crack that test
         * the connection with a special httpclient
         */
        @Override
        public void onReceivedHttpAuthRequest(final WebView view, final HttpAuthHandler handler,
                final String host, final String realm) {
            String[] userpass = new String[2];

            userpass = view.getHttpAuthUsernamePassword(host, realm);

            HttpResponse response = null;
            HttpGet httpget;
            DefaultHttpClient httpclient;
            String target_host;
            int target_port;

            target_host = MexRemoteActivity.this.target_host;
            target_port = MexRemoteActivity.this.target_port;

            /* We may get null from getHttpAuthUsernamePassword which will
             * break the setCredentials so junk used instead to keep
             * it happy.
             */

            Log.d(dbg, "using the set httpauth, testing auth using client");
            try {
                if (userpass == null) {
                    userpass = new String[2];
                    userpass[0] = "none";
                    userpass[1] = "none";
                }
            } catch (Exception e) {
                userpass = new String[2];
                userpass[0] = "none";
                userpass[1] = "none";
            }

            /* Log.d ("debug",
             *  "trying: GET http://"+userpass[0]+":"+userpass[1]+"@"+target_host+":"+target_port+"/");
             */
            /* We're going to test the authentication credentials that we
             * have before using them so that we can act on the response.
             */

            httpclient = new DefaultHttpClient();

            httpget = new HttpGet("http://" + target_host + ":" + target_port + "/");

            httpclient.getCredentialsProvider().setCredentials(new AuthScope(target_host, target_port),
                    new UsernamePasswordCredentials(userpass[0], userpass[1]));

            try {
                response = httpclient.execute(httpget);
            } catch (IOException e) {
                Log.d(dbg, "Problem executing the http get");
                e.printStackTrace();
            }

            Log.d(dbg, "HTTP reponse:" + Integer.toString(response.getStatusLine().getStatusCode()));
            if (response.getStatusLine().getStatusCode() == 401) {
                /* We got Authentication failed (401) so ask user for u/p */

                /* login dialog box */
                final AlertDialog.Builder logindialog;
                final EditText user;
                final EditText pass;

                LinearLayout layout;
                LayoutParams params;

                TextView label_username;
                TextView label_password;

                logindialog = new AlertDialog.Builder(MexRemoteActivity.this);

                logindialog.setTitle("Mex Webremote login");

                user = new EditText(MexRemoteActivity.this);
                pass = new EditText(MexRemoteActivity.this);

                layout = new LinearLayout(MexRemoteActivity.this);

                pass.setTransformationMethod(new PasswordTransformationMethod());

                layout.setOrientation(LinearLayout.VERTICAL);

                params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);

                layout.setLayoutParams(params);
                user.setLayoutParams(params);
                pass.setLayoutParams(params);

                label_username = new TextView(MexRemoteActivity.this);
                label_password = new TextView(MexRemoteActivity.this);

                label_username.setText("Username:");
                label_password.setText("Password:");

                layout.addView(label_username);
                layout.addView(user);
                layout.addView(label_password);
                layout.addView(pass);
                logindialog.setView(layout);

                logindialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        dialog.cancel();
                    }
                });

                logindialog.setPositiveButton("Login", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        String uvalue = user.getText().toString().trim();
                        String pvalue = pass.getText().toString().trim();
                        view.setHttpAuthUsernamePassword(host, realm, uvalue, pvalue);

                        handler.proceed(uvalue, pvalue);
                    }
                });
                logindialog.show();
                /* End login dialog box */
            } else /* We didn't get a 401 */
            {
                handler.proceed(userpass[0], userpass[1]);
            }
        } /* End onReceivedHttpAuthRequest */
    }); /* End Override */

    /* Run mdns to check for service in a "runnable" (async) */
    handler.post(new Runnable() {
        public void run() {
            startMdns();
        }
    });

    dialog = ProgressDialog.show(MexRemoteActivity.this, "", "Searching...", true);

    /* Let's put something in the webview while we're waiting */
    String summary = "<html><head><style>body { background-color: #000000; color: #ffffff; }></style></head><body><p>Searching for the media explorer webservice</p><p>More infomation on <a href=\"http://media-explorer.github.com\" >Media Explorer's home page</a></p></body></html>";
    web_view.loadData(summary, "text/html", "utf-8");

}

From source file:com.brq.wallet.activity.modern.AccountsFragment.java

private void deleteAccount(final WalletAccount accountToDelete) {
    Preconditions.checkNotNull(accountToDelete);

    final View checkBoxView = View.inflate(getActivity(), R.layout.delkey_checkbox, null);
    final CheckBox keepAddrCheckbox = (CheckBox) checkBoxView.findViewById(R.id.checkbox);
    keepAddrCheckbox.setText(getString(R.string.keep_account_address));
    keepAddrCheckbox.setChecked(false);//from w  ww .  j  ava2  s .  c o  m

    final AlertDialog.Builder deleteDialog = new AlertDialog.Builder(getActivity());
    deleteDialog.setTitle(R.string.delete_account_title);
    deleteDialog.setMessage(R.string.delete_account_message);

    // add checkbox only for SingleAddressAccounts and only if a private key is present
    final boolean hasPrivateData = accountToDelete instanceof ExportableAccount
            && ((ExportableAccount) accountToDelete).getExportData(AesKeyCipher.defaultKeyCipher()).privateData
                    .isPresent();

    if (accountToDelete instanceof SingleAddressAccount && hasPrivateData) {
        deleteDialog.setView(checkBoxView);
    }

    deleteDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface arg0, int arg1) {
            if (hasPrivateData) {
                Long satoshis = getPotentialBalance(accountToDelete);
                AlertDialog.Builder confirmDeleteDialog = new AlertDialog.Builder(getActivity());
                confirmDeleteDialog.setTitle(R.string.confirm_delete_pk_title);

                // Set the message. There are four combinations, with and without label, with and without BTC amount.
                String label = _mbwManager.getMetadataStorage().getLabelByAccount(accountToDelete.getId());
                String message;

                // For active accounts we check whether there is money on them before deleting. we don't know if there
                // is money on archived accounts
                Optional<Address> receivingAddress = accountToDelete.getReceivingAddress();
                if (accountToDelete.isActive() && satoshis != null && satoshis > 0) {
                    if (label != null && label.length() != 0) {
                        String address;
                        if (receivingAddress.isPresent()) {
                            address = receivingAddress.get().toMultiLineString();
                        } else {
                            address = "";
                        }
                        message = getString(R.string.confirm_delete_pk_with_balance_with_label, label, address,
                                _mbwManager.getBtcValueString(satoshis));
                    } else {
                        message = getString(R.string.confirm_delete_pk_with_balance,
                                receivingAddress.isPresent() ? receivingAddress.get().toMultiLineString() : "",
                                _mbwManager.getBtcValueString(satoshis));
                    }
                } else {
                    if (label != null && label.length() != 0) {
                        message = getString(R.string.confirm_delete_pk_without_balance_with_label, label,
                                receivingAddress.isPresent() ? receivingAddress.get().toMultiLineString() : "");
                    } else {
                        message = getString(R.string.confirm_delete_pk_without_balance,
                                receivingAddress.isPresent() ? receivingAddress.get().toMultiLineString() : "");
                    }
                }
                confirmDeleteDialog.setMessage(message);

                confirmDeleteDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface arg0, int arg1) {
                        if (keepAddrCheckbox.isChecked() && accountToDelete instanceof SingleAddressAccount) {
                            try {
                                ((SingleAddressAccount) accountToDelete)
                                        .forgetPrivateKey(AesKeyCipher.defaultKeyCipher());
                                _toaster.toast(R.string.private_key_deleted, false);
                            } catch (KeyCipher.InvalidKeyCipher e) {
                                throw new RuntimeException(e);
                            }
                        } else {
                            try {
                                walletManager.deleteUnrelatedAccount(accountToDelete.getId(),
                                        AesKeyCipher.defaultKeyCipher());
                                _storage.deleteAccountMetadata(accountToDelete.getId());
                            } catch (KeyCipher.InvalidKeyCipher e) {
                                throw new RuntimeException(e);
                            }
                            _mbwManager.setSelectedAccount(
                                    _mbwManager.getWalletManager(false).getActiveAccounts().get(0).getId());
                            _toaster.toast(R.string.account_deleted, false);
                        }
                        finishCurrentActionMode();
                        _mbwManager.getEventBus().post(new AccountChanged(accountToDelete.getId()));
                    }
                });
                confirmDeleteDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface arg0, int arg1) {
                    }
                });
                confirmDeleteDialog.show();
            } else {
                // account has no private data - dont make a fuzz about it and just delete it
                try {
                    walletManager.deleteUnrelatedAccount(accountToDelete.getId(),
                            AesKeyCipher.defaultKeyCipher());
                    _storage.deleteAccountMetadata(accountToDelete.getId());
                } catch (KeyCipher.InvalidKeyCipher e) {
                    throw new RuntimeException(e);
                }
                finishCurrentActionMode();
                _mbwManager.getEventBus().post(new AccountChanged(accountToDelete.getId()));
                _toaster.toast(R.string.account_deleted, false);
            }
        }

        private Long getPotentialBalance(WalletAccount account) {
            if (account.isArchived()) {
                return null;
            } else {
                Balance balance = account.getBalance();
                return balance.confirmed + balance.pendingChange + balance.pendingReceiving;
            }
        }

    });
    deleteDialog.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface arg0, int arg1) {
        }
    });
    deleteDialog.show();

}

From source file:com.github.akinaru.hcidebugger.activity.HciDebuggerActivity.java

/**
 * setup a filter//from   w w w . j  a  v a 2  s  .  c  om
 */
private void filter() {
    Log.v(TAG, "setting filter");
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(HciDebuggerActivity.this);

    LayoutInflater inflater = getLayoutInflater();
    final View dialogView = inflater.inflate(R.layout.filter_dialog, null);
    dialogBuilder.setView(dialogView);

    //packet type
    setupSpinnerAdapter(R.array.packet_type_array, dialogView, R.id.packet_type_filter,
            filters.getPacketTypeFilter());

    //event type
    setupSpinnerAdapter(R.array.event_type_array, dialogView, R.id.event_type_filter,
            filters.getEventTypeFilter());

    //ogf
    setupSpinnerAdapter(R.array.ogf_array, dialogView, R.id.cmd_ogf_filter, filters.getOgfFilter());

    //subevent_type_filter
    setupSpinnerAdapter(R.array.subevent_array, dialogView, R.id.subevent_type_filter,
            filters.getSubeventFilter());

    EditText addressText = (EditText) dialogView.findViewById(R.id.device_address_edit);
    addressText.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

            filters.setAddress(s.toString());

            SharedPreferences.Editor editor = prefs.edit();
            editor.putString(Constants.PREFERENCES_ADVERTISING_ADDR, s.toString());
            editor.commit();
        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });
    addressText.setText(filters.getAdvertizingAddr());

    final AlertDialog alertDialog = dialogBuilder.create();

    final Button button_withdraw_filter = (Button) dialogView.findViewById(R.id.button_withdraw_filter);

    if (isFiltered)
        button_withdraw_filter.setVisibility(View.VISIBLE);
    else
        button_withdraw_filter.setVisibility(View.GONE);

    button_withdraw_filter.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            isFiltered = false;
            packetAdapter.setPacketList(packetList);
            notifyAdapter();

            alertDialog.cancel();
            alertDialog.dismiss();
            packetFilteredList.clear();
        }
    });

    Button button_apply = (Button) dialogView.findViewById(R.id.button_apply_filter);

    button_apply.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Spinner packet_type_filter = (Spinner) dialogView.findViewById(R.id.packet_type_filter);
            Spinner ogf_filter = (Spinner) dialogView.findViewById(R.id.cmd_ogf_filter);
            Spinner event_type_filter = (Spinner) dialogView.findViewById(R.id.event_type_filter);
            Spinner subevent_type_filter = (Spinner) dialogView.findViewById(R.id.subevent_type_filter);
            EditText device_address_edit = (EditText) dialogView.findViewById(R.id.device_address_edit);

            filters = new Filters(HciDebuggerActivity.this, packet_type_filter.getSelectedItem().toString(),
                    event_type_filter.getSelectedItem().toString(), ogf_filter.getSelectedItem().toString(),
                    subevent_type_filter.getSelectedItem().toString(),
                    device_address_edit.getText().toString());

            packetFilteredList = new ArrayList<Packet>();
            for (int i = 0; i < packetList.size(); i++) {

                if (matchFilter(packetList.get(i))) {
                    packetFilteredList.add(packetList.get(i));
                }
            }

            isFiltered = true;

            packetAdapter.setPacketList(packetFilteredList);
            notifyAdapter();

            alertDialog.cancel();
            alertDialog.dismiss();
        }
    });

    Button button_cancel = (Button) dialogView.findViewById(R.id.button_cancel_filter);

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

    alertDialog.show();
}

From source file:com.brq.wallet.activity.modern.AccountsFragment.java

private void verifyCoinapultMail() {
    AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
    b.setTitle(getString(R.string.coinapult_mail_verification));
    final String email = _mbwManager.getMetadataStorage().getCoinapultMail();
    View diaView = getActivity().getLayoutInflater().inflate(R.layout.ext_coinapult_mail_verification, null);
    final EditText verificationTextField = (EditText) diaView.findViewById(R.id.mailVerification);

    // check if there is a probable verification link in the clipboard and if so, pre-fill the textbox
    String clipboardString = Utils.getClipboardString(getActivity());
    if (!Strings.isNullOrEmpty(clipboardString) && clipboardString.contains("coinapult.com")) {
        verificationTextField.setText(clipboardString);
    }/*ww w.ja  va2s . c  om*/

    b.setView(diaView);
    b.setPositiveButton(getString(R.string.button_done), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String verification = verificationTextField.getText().toString();
            _progress.setCancelable(false);
            _progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            _progress.setMessage(getString(R.string.coinapult_verifying_email));
            _progress.show();
            new VerifyCoinapultMailAsyncTask(verification, email).execute();
            dialog.dismiss();
        }
    });
    b.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    AlertDialog dialog = b.create();
    dialog.show();
}

From source file:com.feathercoin.wallet.feathercoin.ui.AmountCalculatorFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    exchangeCurrency = prefs.getString(Constants.PREFS_KEY_EXCHANGE_CURRENCY,
            Constants.DEFAULT_EXCHANGE_CURRENCY);
    precision = Integer.parseInt(
            prefs.getString(Constants.PREFS_KEY_FTC_PRECISION, Integer.toString(Constants.FTC_PRECISION)));

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(R.string.amount_calculator_dialog_title);

    final View view = inflater.inflate(R.layout.amount_calculator_dialog, null);

    ltcAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_ltc);
    ltcAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (ltcAmountView.getAmount() != null) {
                exchangeDirection = true;

                updateAppearance();/*from   w  w  w .java 2  s .c  o  m*/
            } else {
                localAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    localAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_local);
    localAmountView.setCurrencyCode(exchangeCurrency);
    localAmountView.setPrecision(Constants.LOCAL_PRECISION);
    localAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (localAmountView.getAmount() != null) {
                exchangeDirection = false;

                updateAppearance();
            } else {
                ltcAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    exchangeRateView = (TextView) view.findViewById(R.id.amount_calculator_rate);

    dialog.setView(view);

    dialog.setPositiveButton(R.string.amount_calculator_dialog_button_use,
            new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int whichButton) {
                    done();
                }
            });
    dialog.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int whichButton) {
            dismiss();
        }
    });

    updateAppearance();

    loaderManager.initLoader(0, null, this);

    return dialog.create();
}