Created
November 12, 2019 17:24
-
-
Save matthewmorrone/8bf426931c88dda832e492bcea275eae to your computer and use it in GitHub Desktop.
show alert dialog from anywhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new AlertDialog.Builder(getActivity()) | |
.setTitle(getString(R.string.dialog_title)) | |
.setMessage(getString(R.string.dialog_text)) | |
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
// OK clicked | |
} | |
}) | |
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
// CANCEL clicked | |
} | |
}).show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment