Saturday, 25 April 2020

ALERT DIALOGUE IN ANDROID APP

HOW TO SHOW ALERT DIALOGUE IN ANDROID APP 

YOUTUBE VIDEO CODE


 private void showAlert(String title, String message) {
        AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
        alert.setTitle(title);
        alert.setMessage(message);
        alert.setPositiveButton("YES", (dialog, which) -> {
            Toast.makeText(this, "Record Deleted Successfully", Toast.LENGTH_SHORT).show();
        });
        alert.setNegativeButton("NO", null);
        alert.setNeutralButton("CANCEL",null);
        alert.create();
        alert.setCancelable(false);
        alert.show();
    }

No comments:

Post a Comment