/** * Attach a listener that creates a token using a {@link rx.Subscription} and the * synchronous {@link com.stripe.android.Stripe#createTokenSynchronous(Card, string)} method. * * Only gets attached once, unless you call {@link #clearReferences()}. * * @param button a button that, when clicked, gets a token. * @return a reference to the {@link RxTokenController} */ public RxTokenController AttachRxTokenController(Button button) { if (mRxTokenController == null) { mRxTokenController = new RxTokenController( button, mCardInputWidget, mContext, mErrorDialogHandler, mListViewController, mProgresDialogController, PUBLISHABLE_KEY); } return(mRxTokenController); }
/** * Clear all the references so that we can start over again. */ public void ClearReferences() { if (mAsyncTaskController != null) { mAsyncTaskController.Detach(); } if (mRxTokenController != null) { // mRxTokenController.Detach(); } if (mIntentServiceTokenController != null) { mIntentServiceTokenController.Detach(); } mAsyncTaskController = null; mRxTokenController = null; mIntentServiceTokenController = null; }