0

我正在尝试使用 paypal-android-sdk 构建一个电子商务应用程序。我已经尝试了 sdk 版本:2.14.2、2.15.3、2.16.0 for Android studio 版本 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)
            }
        }
    }

4

1 回答 1

0

onActivityResult您的方法名称不应该是OnActivityResult

第一个字母是小写字符。

于 2020-10-02T13:30:03.040 回答