With this library you can easily use alert dialog in Android.
With Two Buttons |
With One Button |
To install the library just add this line to your gradle:
implementation 'com.github.TecOrb-Developers:SmartAlertDialog:v1.0'
And add this where you want:
new SmartDialogBuilder(context)
.setTitle("Smart Dialog")
.setSubTitle("This is the alert dialog to showing alert to user")
.setCancalable(false)
.setTitleFont(titleFont) //set title font
.setSubTitleFont(subTitleFont) //set sub title font
.setNegativeButtonHide(true) //hide cancel button
.setPositiveButton("OK", new SmartDialogClickListener() {
@Override
public void onClick(SmartDialog smartDialog) {
Toast.makeText(context,"Ok button Click",Toast.LENGTH_SHORT).show();
smartDialog.dismiss();
}
}).setNegativeButton("Cancel", new SmartDialogClickListener() {
@Override
public void onClick(SmartDialog smartDialog) {
Toast.makeText(context,"Cancel button Click",Toast.LENGTH_SHORT).show();
smartDialog.dismiss();
}
}).build().show();
If you liked this library, add a star to this project and feel free to make a fork!