Braintree/src/main/java/com/braintreepayments/api/BraintreeFragment.java
public <T extends BraintreeListener> void addListener(T listener) {
        if (listener instanceof ConfigurationListener) {
            mConfigurationListener = (ConfigurationListener) listener;
        }

        if (listener instanceof BraintreeCancelListener) {
            mCancelListener = (BraintreeCancelListener) listener;
        }

        if (listener instanceof PaymentMethodNoncesUpdatedListener) {
            mPaymentMethodNoncesUpdatedListener = (PaymentMethodNoncesUpdatedListener) listener;
        }

        if (listener instanceof PaymentMethodNonceCreatedListener) {
            mPaymentMethodNonceCreatedListener = (PaymentMethodNonceCreatedListener) listener;
        }

        if (listener instanceof PaymentMethodNonceDeletedListener) {
            mPaymentMethodNonceDeletedListener = (PaymentMethodNonceDeletedListener) listener;
        }

        if (listener instanceof BraintreePaymentResultListener) {
            mBraintreePaymentResultListener = (BraintreePaymentResultListener) listener;
        }

        if (listener instanceof BraintreeErrorListener) {
            mErrorListener = (BraintreeErrorListener) listener;
        }

        if (listener instanceof UnionPayListener) {
            mUnionPayListener = (UnionPayListener) listener;
        }

        if (listener instanceof AmericanExpressListener) {
            mAmericanExpressListener = (AmericanExpressListener) listener;
        }

        flushCallbacks();
    }
public <T extends BraintreeListener> void addListener(T listener) {
        if (listener instanceof ConfigurationListener) {
            mConfigurationListener = (ConfigurationListener) listener;
        }

        if (listener instanceof BraintreeCancelListener) {
            mCancelListener = (BraintreeCancelListener) listener;
        }

        if (listener instanceof PaymentMethodNoncesUpdatedListener) {
            mPaymentMethodNoncesUpdatedListener = (PaymentMethodNoncesUpdatedListener) listener;
        }

        if (listener instanceof PaymentMethodNonceCreatedListener) {
            mPaymentMethodNonceCreatedListener = (PaymentMethodNonceCreatedListener) listener;
        }

        if (listener instanceof PaymentMethodNonceDeletedListener) {
            mPaymentMethodNonceDeletedListener = (PaymentMethodNonceDeletedListener) listener;
        }

        if (listener instanceof BraintreePaymentResultListener) {
            mBraintreePaymentResultListener = (BraintreePaymentResultListener) listener;
        }

        if (listener instanceof BraintreeErrorListener) {
            mErrorListener = (BraintreeErrorListener) listener;
        }

        if (listener instanceof UnionPayListener) {
            mUnionPayListener = (UnionPayListener) listener;
        }

        if (listener instanceof AmericanExpressListener) {
            mAmericanExpressListener = (AmericanExpressListener) listener;
        }

        flushCallbacks();
    }
Adds a listener.

@param listener the listener to add.