I m trying to build an ecommerce app using paypal-android-sdk. I have tried the sdk version: 2.14.2, 2.15.3, 2.16.0 for Android studio version 3.5.3
The result is the same and it show the above message: onActivityResult overrides nothing.
I did add ? after Intent. what is the problem? Can someone help me on this? appreciate your help.
below is the code:
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)
}
}
}
Your method name should be onActivityResult
not OnActivityResult
the first letter is a lower case character.