Example usage for android.content DialogInterface BUTTON_POSITIVE

List of usage examples for android.content DialogInterface BUTTON_POSITIVE

Introduction

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

Prototype

int BUTTON_POSITIVE

To view the source code for android.content DialogInterface BUTTON_POSITIVE.

Click Source Link

Document

The identifier for the positive button.

Usage

From source file:Main.java

static public void showAlert(Context ctx, final String message) {
    AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();
    alertDialog.setTitle("Application Error");
    alertDialog.setMessage(message);//from w  ww  .  j av a  2s.c o m
    alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Dismiss", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Do nothing
        }
    });
    alertDialog.show();
}

From source file:Main.java

public static AlertDialog showAlertMessage(String title, String message, Context context) {
    final AlertDialog alertDialog = new AlertDialog.Builder(context).create();
    alertDialog.setTitle(title);//from ww w.  j a v  a2 s.c  o  m
    alertDialog.setMessage(message);
    alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
        }
    });
    alertDialog.show();
    return alertDialog;
}

From source file:Main.java

public static void showAlertDialog(Context context, String title, String message) {
    AlertDialog dialog = new AlertDialog.Builder(context).create();
    dialog.setCancelable(true);/*from   w w w  .j a  v  a2  s . co m*/
    dialog.setMessage(message);
    dialog.setTitle(title);
    dialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    dialog.show();
}

From source file:se.ottomatech.marcusjacobsson.eaglenote.dialogfragments.DialogFragmentLicenseFailed.java

@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
    case DialogInterface.BUTTON_NEGATIVE:
        dialog.dismiss();//from ww  w  .j a v a  2  s.  c om
        getActivity().finish();
        break;

    case DialogInterface.BUTTON_POSITIVE:
        getActivity().finish();
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                "http://www.https://play.google.com/store/apps/details?id=se.ottomatech.marcusjacobsson.eaglenote.pro"));
        startActivity(intent);
        break;

    }
}

From source file:org.mariotaku.twidere.fragment.DestroyStatusDialogFragment.java

@Override
public void onClick(final DialogInterface dialog, final int which) {
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        final ParcelableStatus status = getStatus();
        final AsyncTwitterWrapper twitter = mTwitterWrapper;
        if (status == null || twitter == null)
            return;
        twitter.destroyStatusAsync(status.account_key, status.id);
        break;//from  www .  ja  v a  2  s.  c o m
    default:
        break;
    }
}

From source file:se.ottomatech.marcusjacobsson.eaglenote.dialogfragments.DialogFragmentLicenseRetry.java

@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
    case DialogInterface.BUTTON_NEGATIVE:
        dialog.dismiss();/*ww  w.  j  av a 2s. c  o m*/
        getActivity().finish();
        break;

    case DialogInterface.BUTTON_POSITIVE:
        mListener.onLicenceRetryPositiveClick();
        dialog.dismiss();
        break;
    }
}

From source file:org.mariotaku.twidere.fragment.DestroyUserListDialogFragment.java

@Override
public void onClick(final DialogInterface dialog, final int which) {
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        final ParcelableUserList userList = getUserList();
        final AsyncTwitterWrapper twitter = twitterWrapper;
        if (userList == null || twitter == null)
            return;
        twitter.destroyUserListAsync(userList.account_key, userList.id);
        break;/*from   ww  w  . j a v  a  2  s  . c om*/
    default:
        break;
    }
}

From source file:org.mariotaku.twidere.fragment.DestroySavedSearchDialogFragment.java

@Override
public void onClick(final DialogInterface dialog, final int which) {
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        final UserKey accountKey = getAccountKey();
        final long searchId = getSearchId();
        final AsyncTwitterWrapper twitter = twitterWrapper;
        if (searchId <= 0)
            return;
        twitter.destroySavedSearchAsync(accountKey, searchId);
        break;/*  w  ww  .  ja  va  2  s .c  o  m*/
    default:
        break;
    }
}

From source file:org.mariotaku.twidere.fragment.DestroyUserListSubscriptionDialogFragment.java

@Override
public void onClick(final DialogInterface dialog, final int which) {
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        final ParcelableUserList userList = getUserList();
        final AsyncTwitterWrapper twitter = mTwitterWrapper;
        if (userList == null || twitter == null)
            return;
        twitter.destroyUserListSubscriptionAsync(userList.account_key, userList.id);
        break;//  w ww  .j a va 2 s . c  o  m
    default:
        break;
    }
}

From source file:org.mariotaku.twidere.fragment.ReportSpamDialogFragment.java

@Override
public void onClick(final DialogInterface dialog, final int which) {
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        final ParcelableUser user = getUser();
        final AsyncTwitterWrapper twitter = mTwitterWrapper;
        if (user == null || twitter == null)
            return;
        twitter.reportSpamAsync(user.account_key, user.key);
        break;/*  ww  w  . j  a v  a  2 s.co  m*/
    default:
        break;
    }
}