Skip to content

Instantly share code, notes, and snippets.

@ashishkudale
Last active April 11, 2020 17:03
Show Gist options
  • Save ashishkudale/5e9ba5d169d5e130d5c0ea2700b57155 to your computer and use it in GitHub Desktop.
Save ashishkudale/5e9ba5d169d5e130d5c0ea2700b57155 to your computer and use it in GitHub Desktop.
showAlertDialog helps to show dialog box with custom title,message and OnClickListener
private void showAlertDialog(String title, String message, String positiveButtonText, String negativeButtonText, DialogInterface.OnClickListener positiveListener, DialogInterface.OnClickListener negativeListener) {
AlertDialog dialog = new AlertDialog.Builder(CameraPermission.this)
.setPositiveButton(positiveButtonText, positiveListener)
.setNegativeButton(negativeButtonText, negativeListener)
.create();
if (title != null || !title.isEmpty()) {
dialog.setTitle(title);
}
dialog.setMessage(message);
dialog.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment