Advertisement
ali50mahmoud

alertDialog

Mar 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. AlertDialog alertDialog = new AlertDialog.Builder(
  2. AlertDialogActivity.this).create();
  3.  
  4. // Setting Dialog Title
  5. alertDialog.setTitle("Alert Dialog");
  6.  
  7. // Setting Dialog Message
  8. alertDialog.setMessage("Welcome to AndroidHive.info");
  9.  
  10. // Setting Icon to Dialog
  11. alertDialog.setIcon(R.drawable.tick);
  12.  
  13. // Setting OK Button
  14. alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
  15. public void onClick(DialogInterface dialog, int which) {
  16. // Write your code here to execute after dialog closed
  17. Toast.makeText(getApplicationContext(), "You clicked on OK", Toast.LENGTH_SHORT).show();
  18. }
  19. });
  20.  
  21. // Showing Alert Message
  22. alertDialog.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement