Example usage for android.app AlertDialog.Builder create

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

Introduction

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

Prototype

public void create() 

Source Link

Document

Forces immediate creation of the dialog.

Usage

From source file:com.HskPackage.HskNamespace.HSK1ProjectActivity.java

public void showDef(View v) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(ssignificato).setCancelable(false).setNegativeButton("Clear",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();/*from  w  ww . j ava 2 s  .co  m*/
                }
            });

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

From source file:com.lepin.activity.MyCarVeficActivity.java

/**
 * ?//  ww  w . j a va 2s.c o  m
 */
protected void choiceCareType() {
    AlertDialog.Builder builder = new AlertDialog.Builder(MyCarVeficActivity.this);
    builder.setTitle(R.string.my_car_vefic_chtype).setItems(carTypes, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            vfType.setText(carTypes[which]);
        }
    });
    builder.create().show();
}

From source file:com.gmail.at.faint545.fragments.HistoryFragment.java

private AlertDialog buildAlertDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setMessage(R.string.connect_error);
    builder.setCancelable(false);//from   w  ww  . ja  va  2s.  co m
    builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    return builder.create();
}

From source file:edu.asu.bsse.vtanders.finalproject.MainActivity.java

License:asdf

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_config) {
        AlertDialog.Builder connInfoDialogBuilder = new AlertDialog.Builder(this);
        connInfoDialogBuilder.setTitle("Server Information");
        final View view = getLayoutInflater().inflate(R.layout.server_config, null);
        connInfoDialogBuilder.setView(view);
        final AlertDialog connInfoDialog = connInfoDialogBuilder.create();
        connInfoDialog.show();/*from  w ww.jav a2 s.c o  m*/
        Button apply = (Button) view.findViewById(R.id.apply_settings_button);
        apply.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                EditText hostET = (EditText) view.findViewById(R.id.host_content);
                String host = hostET.getText().toString();

                EditText portET = (EditText) view.findViewById(R.id.port_content);
                int port = Integer.valueOf(portET.getText().toString());

                EditText nickET = (EditText) view.findViewById(R.id.nickname_content);
                String nick = nickET.getText().toString();

                Log.d("ASDF", host + " " + port + " " + nick);

                new SetupConnectionTask(host, port, nick).execute();
                connInfoDialog.dismiss();
            }
        });

        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:me.ziccard.secureit.async.upload.AuthenticatorTask.java

/**
 * Shows an authentication failure dialog
 *///from ww  w. j  av  a  2s. c o  m
public void showFailureDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setMessage("Authentication failed").setCancelable(false).setPositiveButton("Ok",
            new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub

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

From source file:br.ufg.inf.es.fs.contpatri.mobile.webservice.EnviarColeta.java

/**
 * Mtodo que exibe um <code>Dialog</code> caso haja erro no login do
 * usurio no aplicativo.//ww w .jav  a2  s. c  o  m
 */
private void mostrarDialogo() {

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

    builder.setTitle("Erro");
    builder.setMessage(mensagem);
    builder.setIcon(android.R.drawable.ic_dialog_alert);

    builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            dialog.dismiss();
        }
    });

    final AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();

}

From source file:org.peterbaldwin.client.android.tinyurl.SendTinyUrlActivity.java

void handleError(Throwable throwable) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    if (throwable instanceof MalformedURLException) {
        builder.setMessage(R.string.message_invalid_url);
    } else {//from   w  w w .j av a 2s  .c  om
        // TODO: User-friendly error messages
        builder.setMessage(String.valueOf(throwable));
    }
    builder.setPositiveButton(R.string.button_ok, this);
    AlertDialog dialog = builder.create();
    dialog.show();
}

From source file:com.octade.droid.ilesansfil.IleSansFil.java

private void about() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setMessage("\n" + "Android Application" + "\n" + "version: " + mainApp.getVersion() + "\n\n"
            + "Octade Technologies inc.\n" + "http://octade.virtuelnet.com\n").setInverseBackgroundForced(true)
            .setTitle("Ile sans fil").setIcon(mainApp.getIcon()).setCancelable(true);
    AlertDialog alert = builder.create();
    alert.show();// w w w .ja v  a  2s . c o m
}

From source file:com.sakisds.icymonitor.activities.ConnectionActivity.java

void showErrorDialog(int title, int message) {
    AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
    dlgAlert.setTitle(getResources().getString(title));
    dlgAlert.setMessage(getResources().getString(message));
    dlgAlert.setPositiveButton("OK", null);
    dlgAlert.setCancelable(true);/*from   w w w . jav  a  2 s.c o  m*/
    dlgAlert.create().show();
}