Show dynamic alert in android

public static void createErrorAlert(Context context,String title, String msg, String btntxt){
AlertDialog.Builder builder = new AlertDialog.Builder(context);
if(title != “”)
builder.setTitle(title);
builder.setMessage(msg)
.setCancelable(false)
.setPositiveButton(btntxt, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alert = builder.create();
alert.show();
}

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*
Website