java - Stripe Android - AddPaymentMethodActivityStarter 获取页脚布局事件
问题描述
我正在集成条纹的添加卡片屏幕。
使用 stripe 的 AddPaymentMethodActivityStarter 启动添加卡屏幕
使用以下代码:
// launch stripe's add card UI
new AddPaymentMethodActivityStarter(StripeAddCardActivity.this).startForResult(
new AddPaymentMethodActivityStarter.Args.Builder()
.setAddPaymentMethodFooter(R.layout.stripe_footer_layout)
.build());
//initalize checkbox
CheckBox stripeSaveCardCheckbox = findViewById(R.id.stripeSaveCardCheckbox);
if(stripeSaveCardCheckbox !=null){
if(stripeSaveCardCheckbox.isChecked()){
Toast.makeText(this, "save card", Toast.LENGTH_LONG).show();
}else{
Toast.makeText(this, "don't save card",Toast.LENGTH_LONG).show();
}
}else{
Toast.makeText(this, "CHECKBOX NULL", Toast.LENGTH_LONG).show();
}
我需要获取页脚布局(R.layout.stripe_footer_layout)的复选框值。但即使在初始化它之后,我总是得到空值。
谁能帮我从条纹的添加卡片屏幕中获取页脚 XML 值?
stripe_footer_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/stripeSaveCardCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:background="@color/transparent"
android:button="@drawable/checkbox_portmonie_selector"
android:checked="true"
android:paddingStart="10dp"
android:layout_marginTop="8dp"
android:singleLine="true"
android:fontFamily="@fonts/helvetica_new"
android:textSize="@dimen/community_avis_16px"
android:text="@string/hint_card_checkbox_content"
android:textColor="@color/community_black_color" />
</LinearLayout>
解决方案
推荐阅读
- python - 类方法从其先前的执行继承列表(Python)
- c# - 即使路径正常,图像也未显示
- python - 使用 Python 和 Libtorrent 加载磁力种子
- php - 查询在家工作但不在其他页面工作(Laravel 5.4)
- jquery - 如何用 jQuery 事件对象填充 event.data?
- python-3.x - 根据数据帧切换 fasta seq
- django - 如何为 django-oauth-toolkit 实现 html 视图?
- javascript - 使用 javascript 和 jquery 更改 div 的样式
- laravel - Laravel 存储图片的权限为 600
- azure - 如何停止在 Azure 通知中心为同一个 DeviceToken 生成多个 RegistrationId?