Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
- builder.setTitle("Custom Dialog");
- builder.setMessage("This is a custom dialog.");
- builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- //Do something
- }
- });
- builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- //Do something
- }
- });
- AlertDialog dialog = builder.create();
- dialog.show();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement