Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. /**
  2. * Create a generic alertDialog with title and text. No buttons here, we do this elsewhere
  3. *
  4. * @param dialogTitle -> What we want the title of the dialog to be.
  5. * @param dialogMessage -> What we want the message of the dialog to be.
  6. * @param context -> context
  7. */
  8. public AlertDialog createGenericDialog(String dialogTitle, String dialogMessage, Context context) {
  9. AlertDialog alertDialog = new AlertDialog.Builder(context).create();
  10. alertDialog.setTitle(dialogTitle);
  11. alertDialog.setMessage(dialogMessage);
  12. alertDialog.setCanceledOnTouchOutside(false);
  13. return alertDialog;
  14. }
  15.  
  16. /**
  17. * Create an dialog informing the user of an error when an exception has been thrown.
  18. *
  19. * @param context -> context
  20. * @param errorType -> The type of name of the exception that is been thrown.
  21. * @param locale -> Where the exception has been thrown.
  22. * @param errorMessage -> A more understandable message describing the error
  23. */
  24. public void createErrorDialog(String errorType, String locale, String errorMessage, Context context){
  25. AlertDialog alertDialog = createGenericDialog(errorType, locale + "\n" + errorMessage, context);
  26. alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, context.getString(R.string.ok), dismissButtonListener());
  27. alertDialog.show();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement