Example usage for android.content DialogInterface cancel

List of usage examples for android.content DialogInterface cancel

Introduction

In this page you can find the example usage for android.content DialogInterface cancel.

Prototype

void cancel();

Source Link

Document

Cancels the dialog, invoking the OnCancelListener .

Usage

From source file:com.springsource.greenhouse.events.sessions.EventSessionRatingActivity.java

private void showResult(String result) {
    //      Toast.makeText(this, result, Toast.LENGTH_LONG).show();
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(result);/*from w  w  w.j  a v a 2 s . c  om*/
    builder.setCancelable(false);
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.givon.anhao.BaseActivity.java

public void showDialogMessage(int textRes) {
    Builder ibuilder = new AppDialog.Builder(this);
    ibuilder.setMessage(textRes);//from ww  w .  java2  s  . c o m
    ibuilder.setPositiveButton(R.string.know, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    ibuilder.create().show();
}

From source file:com.flurry.samples.tumblrsharing.PhotoDetailActivity.java

void displayAlert(String title, String msg) {
    AlertDialog.Builder alertBox = new AlertDialog.Builder(PhotoDetailActivity.this);
    alertBox.setTitle(title).setMessage(msg).setNeutralButton("OK", new DialogInterface.OnClickListener() {

        @Override/*from   w ww . ja va 2 s.  c  om*/
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    }).setCancelable(true).show();
}

From source file:com.givon.anhao.BaseActivity.java

public void showDialogMessage(String text) {

    Builder ibuilder = new AppDialog.Builder(this);
    ibuilder.setMessage(text);// w w  w  .jav a 2s. co  m
    ibuilder.setPositiveButton(R.string.know, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    ibuilder.create().show();
}

From source file:com.directsiding.android.ConfigActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    /* Si el usuario viene de LoginActivity, volvemos a ella. Si viene de la webview activity, emulamos el
     * boton back.//from  w w  w  .  java2  s .  c o m
     */
    case android.R.id.home:
        if (previousActivity.equals(getString(R.string.LoginActivity))) {
            NavUtils.navigateUpFromSameTask(this);
        } else {
            onBackPressed();
        }
        return true;
    case R.id.action_about:
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
        alertDialogBuilder.setTitle(R.string.AlertDialogTitle).setMessage(R.string.AlertDialogMessage)
                .setCancelable(false).setPositiveButton("Salir", new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });
        AlertDialog alertDialog = alertDialogBuilder.create();
        alertDialog.show();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:li.klass.fhem.fragments.SendCommandFragment.java

private void sendCommandIntent(String command) {
    final Context context = getActivity();
    Intent intent = new Intent(Actions.EXECUTE_COMMAND);
    intent.setClass(getActivity(), SendCommandIntentService.class);
    intent.putExtra(BundleExtraKeys.COMMAND, command);
    intent.putExtra(BundleExtraKeys.RESULT_RECEIVER, new ResultReceiver(new Handler()) {
        @Override//from w w w.j a  v  a2s .  co  m
        protected void onReceiveResult(int resultCode, Bundle resultData) {
            if (resultData != null && resultCode == ResultCodes.SUCCESS
                    && resultData.containsKey(BundleExtraKeys.COMMAND_RESULT)) {
                String result = resultData.getString(BundleExtraKeys.COMMAND_RESULT);
                if (result == null || result.equals("")) {
                    update(false);
                    return;
                }

                if (isEmpty(result.replaceAll("[\\r\\n]", "")))
                    return;
                new AlertDialog.Builder(context).setTitle(R.string.command_execution_result).setMessage(result)
                        .setPositiveButton(R.string.okButton, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                dialogInterface.cancel();
                                update(false);
                            }
                        }).show();
            }
        }
    });
    getActivity().startService(intent);
}

From source file:it.sasabz.android.sasabus.InfoActivity.java

/**
 * Called when the activity is about to start interacting with the user.
 *//*  w w  w  .j ava 2s  . co m*/
@Override
protected void onResume() {
    super.onResume();
    if (haveNetworkConnection())
        fillData();
    else {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setCancelable(true);
        builder.setMessage(R.string.no_network_connection);
        builder.setTitle(R.string.error_title);
        builder.setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

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

From source file:com.darshancomputing.BatteryIndicatorPro.NotificationWizard.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View v = getActivity().getLayoutInflater().inflate(R.layout.notification_wizard_content, null);
    lv = (ListView) v.findViewById(android.R.id.list);

    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            setValue(position);/*from   w w  w.j a v a 2 s . co m*/
        }
    });

    return new AlertDialog.Builder(getActivity()).setView(v).setTitle(R.string.notification_wizard_title)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface di, int id) {
                    di.cancel();
                }
            }).create();
}

From source file:com.app.blockydemo.ui.dialogs.NewVariableDialog.java

@Override
public Dialog onCreateDialog(Bundle bundle) {
    final View dialogView = LayoutInflater.from(getActivity())
            .inflate(R.layout.dialog_formula_editor_variable_name, null);

    final Dialog dialogNewVariable = new AlertDialog.Builder(getActivity()).setView(dialogView)
            .setTitle(R.string.formula_editor_variable_dialog_title)
            .setNegativeButton(R.string.cancel_button, new OnClickListener() {
                @Override/*from   w w w.  ja  va2 s. co  m*/
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            }).setPositiveButton(R.string.ok, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    handleOkButton(dialogView);
                }
            }).create();

    dialogNewVariable.setCanceledOnTouchOutside(true);
    dialogNewVariable.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    dialogNewVariable.setOnShowListener(new OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            handleOnShow(dialogNewVariable);
        }
    });

    return dialogNewVariable;
}

From source file:com.hyperkode.friendshare.fragment.LoginFragment.java

private void showMessage(String msg) {
    AlertDialog.Builder builder = new AlertDialog.Builder(mThisActivity);
    builder.setMessage(msg).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }/*from  w  w w. j a  v a2 s . co  m*/
    });
    //
    builder.create().show();
}