Example usage for android.app AlertDialog.Builder setTitle

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

Introduction

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

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:net.alchemiestick.katana.winehqappdb.SearchView.java

private Dialog about_dialog() {
    String msg = "Copyright May 25th 2012 by Rene Kjellerup (aka Katana Steel) and Alchemiestick.\n\n";
    msg += "WineHQ Appdb Search is released under GPLv3 or later. It uses images from WINE project under LGPLv2 or later ";
    msg += "see license:\nhttp://www.gnu.org/licenses/\nfor more infomation about the licenses.\n\n";
    msg += "Souce code for the program can be obtained at\nhttps://github.com/Katana-Steel/winehqappdb\nand choose ";
    msg += "the apropriate release tag for the the version you are running.";
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("About").setMessage(msg).setCancelable(true).setNeutralButton("Ok",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();/* ww  w. j  a  v  a 2 s  .c o  m*/
                }
            });
    return builder.create();
}

From source file:de.grobox.blitzmail.SendActivity.java

private void showError(String text) {
    // close notification first
    mNotifyManager.cancel(0);//from  w ww .j  a  v  a 2  s.co  m

    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setTitle(getString(R.string.app_name) + " - " + getString(R.string.error));
    builder.setMessage(text);
    builder.setIcon(android.R.drawable.ic_dialog_alert);

    // Add the buttons
    builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // User clicked Cancel button, close this Activity
            finish();
        }
    });
    // Create and show the AlertDialog
    AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
}

From source file:it.simoneloru.ctmdroid.activities.TimetableActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
    alertBuilder.setMessage(R.string.unknowHost);
    alertBuilder.setTitle(android.R.string.dialog_alert_title);
    alertBuilder.setIcon(android.R.drawable.ic_dialog_alert);
    alertBuilder.setPositiveButton(android.R.string.ok, null);
    AlertDialog eulaMsg = alertBuilder.create();
    return eulaMsg;
}

From source file:com.eTilbudsavis.sdkdemo.CatalogViewer.java

private void dialog(String title, String message) {
    AlertDialog.Builder b = new Builder(CatalogViewer.this);
    b.setTitle(title);
    b.setMessage(message);//from  w ww  . j  a  va 2  s. c  o m
    b.setPositiveButton("OK", new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    b.show();

}

From source file:com.chaosinmotion.securechat.fragments.OnboardingForgotPassword.java

private void doResetPassword() {
    try {//  www .  ja  v  a 2s. c om
        JSONObject d = new JSONObject();
        d.put("username", username.getText().toString());
        SCNetwork.get().request("login/forgotpassword", d, this, new SCNetwork.ResponseInterface() {
            @Override
            public void responseResult(SCNetwork.Response response) {
                if (response.isSuccess()) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                    builder.setMessage(R.string.reset_password_message);
                    builder.setTitle(R.string.reset_password_title);
                    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            wizardInterface.goBack();
                        }
                    });
                    builder.show();
                }
            }
        });
    } catch (JSONException ex) {
    }
}

From source file:net.eledge.android.europeana.gui.dialog.NameInputDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();

    View view = inflater.inflate(R.layout.dialog_nameinput, null);
    TextView text = (TextView) view.findViewById(R.id.dialog_nameinput_textview);
    if (resText != -1) {
        text.setText(resText);/*from  ww  w  .j  a va2s. c  o m*/
    } else {
        text.setVisibility(View.GONE);
    }
    mInput = (EditText) view.findViewById(R.id.dialog_nameinput_edittext);
    mInput.setHint(resInput);
    mInput.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            //ignore
        }

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

        @Override
        public void afterTextChanged(Editable s) {
            mDialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(StringUtils.isNotBlank(s.toString()));
        }
    });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setView(view);
    if (resTitle != -1) {
        builder.setTitle(resTitle);
    }
    builder.setPositiveButton(resPositiveButton, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            String input = mInput.getText().toString();
            if (StringUtils.isNotBlank(input)) {
                mListener.positiveResponse(input);
                NameInputDialog.this.dismiss();
            }
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            mListener.negativeResponse();
            mDialog.dismiss();
        }
    });
    mDialog = builder.create();
    mDialog.setCanceledOnTouchOutside(false);
    mDialog.setCancelable(false);
    return mDialog;
}

From source file:org.quizpoll.net.HttpHelper.java

/**
 * Shows dialog for forced update/*from w w w  .j a  v a  2  s  . c om*/
 */
private void showUpgradeRequiredDialog() {
    AlertDialog.Builder alert = new AlertDialog.Builder(activity);
    alert.setTitle(R.string.update_required);
    alert.setMessage(R.string.update_required_description);
    alert.setPositiveButton(R.string.go_to_market, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(AboutActivity.MARKET_LISTING));
            activity.startActivity(intent);
        }
    });
    Dialog dialog = alert.create();
    dialog.setOwnerActivity(activity);
    dialog.show();
}

From source file:geert.stef.sm.beheerautokm.AddRitActivity.java

public void showNotValidNumberDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Not a valid number").setMessage("Something like \"12.34\"")
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    //do some thing here which you need
                }/*  ww w.j av  a  2 s  .  c o  m*/
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.klick.plugins.listviewalert.ListViewAlert.java

public void loadList(final JSONArray thelist, final CallbackContext callbackContext) {
    final CordovaInterface cordova = this.cordova;
    Runnable runnable = new Runnable() {
        public void run() {
            List<String> list = new ArrayList<String>();
            // we start with index 1 because index 0 is the title
            for (int x = 1; x < thelist.length(); x++) {
                try {
                    list.add(thelist.getString(x));
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }/*from   w  ww.ja  v a  2 s .c  o  m*/
            }
            CharSequence[] items = list.toArray(new CharSequence[list.size()]);
            AlertDialog.Builder builder = new AlertDialog.Builder(
                    new ContextThemeWrapper(cordova.getActivity(), android.R.style.Theme_Holo_Dialog));
            try {
                builder.setTitle(thelist.getString(0));
                // builder.setMessage( "This is a hardcoded message to try whether or not this is feasible!");
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } // index 0 contains the title
            builder.setItems(items, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {
                    dialog.dismiss();
                    // we +1 to item because item starts from 0, but from
                    // thelist[0], that was the title...
                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, item + 1));
                    //callbackContext.sendPluginResult(pluginResult)
                }
            });
            AlertDialog alert = builder.create();
            alert.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
            alert.show();
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}

From source file:geert.stef.sm.beheerautokm.AddRitActivity.java

public void showAddedDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Added").setMessage("The number is added.").setIcon(android.R.drawable.ic_dialog_alert)
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    //do some thing here which you need
                }/*from  w ww.  j  ava 2s . co m*/
            });
    /*builder.setNegativeButton("No", new DialogInterface.OnClickListener()
    {
    public void onClick(DialogInterface dialog, int which)
    {
        dialog.dismiss();
    }
    });*/
    AlertDialog alert = builder.create();
    alert.show();
}