Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AlertDialog alertDialog = new AlertDialog.Builder(
- AlertDialogActivity.this).create();
- // Setting Dialog Title
- alertDialog.setTitle("Alert Dialog");
- // Setting Dialog Message
- alertDialog.setMessage("Welcome to AndroidHive.info");
- // Setting Icon to Dialog
- alertDialog.setIcon(R.drawable.tick);
- // Setting OK Button
- alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- // Write your code here to execute after dialog closed
- Toast.makeText(getApplicationContext(), "You clicked on OK", Toast.LENGTH_SHORT).show();
- }
- });
- // Showing Alert Message
- alertDialog.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement