app/src/main/java/com/treslines/pagsegurodemo/AppUtil.java
public static void showConfirmDialog(@NonNull final Context context, @NonNull final String msg, final String btnTxt) {
        if (msg.isEmpty()) {
            throw new IllegalArgumentException("This value can't be empty!");
        }
        final AlertDialog dialog = new AlertDialog.Builder(context).setMessage(msg)
                .setPositiveButton((btnTxt == null ? "Ok" : btnTxt), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }).create();
        dialog.show();
    }
/**
     * Shows a confirm dialog with a custom message and custom quit button text.
     * If you pass null to btnTxt, "ok" will be shown per default.
     *
     * @param context the apps context This value can't be null.
     * @param msg     the message to be shown. his value can't be null or empty.
     * @param btnTxt  the text to be shown in the quit button. For example "close"
     */
Shows a confirm dialog with a custom message and custom quit button text.
If you pass null to btnTxt, "ok" will be shown per default.

@param context the apps context This value can't be null.
@param msg     the message to be shown. his value can't be null or empty.
@param btnTxt  the text to be shown in the quit button. For example "close"
Shows a confirm dialog with a custom message and custom quit button text . If you pass null to btnTxt " ok " will be shown per default . @param context the apps context This value can ' t be null . @param msg the message to be shown . his value can ' t be null or empty . @param btnTxt the text to be shown in the quit button . For example " close "
public static void showConfirmDialog(@NonNull final Context context, @NonNull final String msg, final String btnTxt) {
        if (msg.isEmpty()) {
            throw new IllegalArgumentException("This value can't be empty!");
        }
        final AlertDialog dialog = new AlertDialog.Builder(context).setMessage(msg)
                .setPositiveButton((btnTxt == null ? "Ok" : btnTxt), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }).create();
        dialog.show();
    }
public static void showConfirmDialog ( @ NonNull final Context context , @ NonNull final String msg , final String btnTxt ) { if ( msg . isEmpty ( ) ) { throw new IllegalArgumentException ( "This value can't be empty!" ) ; } final AlertDialog dialog = new AlertDialog . Builder ( context ) . setMessage ( msg ) . setPositiveButton ( ( btnTxt == null ? "Ok" : btnTxt ) , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { dialog . dismiss ( ) ; } } ) . create ( ) ; dialog . show ( ) ; }
Shows a confirm dialog with a custom message and custom quit button text.
Shows a confirm dialog with a custom message and custom quit button text .