使用 paypal sdk 时 OnActivityResult 覆盖没有发生
OnActivityResult override nothing occured when using paypal sdk
我正在尝试使用 paypal-android-sdk 构建电子商务应用程序。我已经尝试过 sdk 版本:2.14.2、2.15.3、2.16.0 for Android studio version 3.5.3
结果是一样的,它显示上面的消息:onActivityResult 不覆盖任何内容。
我确实添加了?意图之后。问题是什么?有人可以帮我吗?感谢您的帮助。
下面是代码:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_pay_pal_payment)
config = PayPalConfiguration().environment(PayPalConfiguration.ENVIRONMENT_SANDBOX)
.clientId(ShoppingCart.client_id)
var i = Intent(this, PayPalService::class.java)
i.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config)
startService(i)
val total_amt:String = intent.getStringExtra("TTL")
Payment_tv_TotalAmount.setText(total_amt)
Payment_btnPay.setOnClickListener {
amount = Payment_tv_TotalAmount.text.toString().toDouble()
var payment = PayPalPayment(BigDecimal.valueOf(amount),"USD","My Pal", PayPalPayment.PAYMENT_INTENT_SALE)
var intent = Intent(this, PaymentActivity::class.java )
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION,config)
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment)
startActivityForResult(intent,my_request_code)
}
}
override fun OnActivityResult(requestCode:Int, resultCode:Int, data:Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == my_request_code){
if(resultCode == Activity.RESULT_OK) {
var i = Intent(this, PaymentConfirmActivity::class.java)
startActivity(i)
}
}
}
您的方法名称应该是 onActivityResult
而不是 OnActivityResult
第一个字母是小写字符。
我正在尝试使用 paypal-android-sdk 构建电子商务应用程序。我已经尝试过 sdk 版本:2.14.2、2.15.3、2.16.0 for Android studio version 3.5.3
结果是一样的,它显示上面的消息:onActivityResult 不覆盖任何内容。
我确实添加了?意图之后。问题是什么?有人可以帮我吗?感谢您的帮助。
下面是代码:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_pay_pal_payment)
config = PayPalConfiguration().environment(PayPalConfiguration.ENVIRONMENT_SANDBOX)
.clientId(ShoppingCart.client_id)
var i = Intent(this, PayPalService::class.java)
i.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config)
startService(i)
val total_amt:String = intent.getStringExtra("TTL")
Payment_tv_TotalAmount.setText(total_amt)
Payment_btnPay.setOnClickListener {
amount = Payment_tv_TotalAmount.text.toString().toDouble()
var payment = PayPalPayment(BigDecimal.valueOf(amount),"USD","My Pal", PayPalPayment.PAYMENT_INTENT_SALE)
var intent = Intent(this, PaymentActivity::class.java )
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION,config)
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment)
startActivityForResult(intent,my_request_code)
}
}
override fun OnActivityResult(requestCode:Int, resultCode:Int, data:Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == my_request_code){
if(resultCode == Activity.RESULT_OK) {
var i = Intent(this, PaymentConfirmActivity::class.java)
startActivity(i)
}
}
}
您的方法名称应该是 onActivityResult
而不是 OnActivityResult
第一个字母是小写字符。