Show alert dialog from anywhere in your Android app

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();
Show alert dialog from anywhere in your Android app.

#android #alert #dialog

#cesarnog

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.