Java Question How to implement onActivityResult in a wrapper?

DonManfred

Expert
Licensed User
Longtime User
Code: Copy
    public void CreatePayment(int amount, String orderID, String description, String email, String bitmap){
        int drawableID = BA.applicationContext.getResources().getIdentifier(bitmap, "drawable", BA.packageName);
    Bitmap image = BitmapFactory.decodeResource(BA.applicationContext.getResources(), drawableID);

    TransactionRequestBuilder builder = new TransactionRequestBuilder(amount, Currency.getInstance("EUR"));
    builder.setDescription(description)
    .setBitmap(image);
    if (!TextUtils.isEmpty(email)) {
        builder.setEmail(email);
    }
    TransactionRequest request = builder.createTransactionRequest();
    //PaylevenApi.initiatePayment(this.getParent(), orderID, request);
    PaylevenApi.initiatePayment(ba.activity, orderID, request);
    }
When executing
Code: Copy
PaylevenApi.initiatePayment
the PayLeven app will be started to handle the Payment.

The docs saying i must override onActivityResult. I tried different things but i did not got the result returned.


Code: Copy
ba.startActivityForResult(ion, intent);
i cannot use because i dont start any intent. So i cant use ba.startactivityforresult

Code: Copy
    //@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        BA.Log("onActivityResult("+requestCode+","+resultCode);
is not called.

When using not "extends Activity" i tried it without the Override.
I tried it with extends Activity and using Override... Both dont work.

I dont know what i can try now... Does anybody have a hint for me?
 

Attachments

This is where inline Java comes into play.

You can create inline java but dont use override annotation. This will hook up your code to be called before the default onActivityResult is called.
To be honest I can't remember properly but do have a look at erels inline java tutorial.

B4A inserts its own code in onavtivtyresult, but it does call super iirc so you can subclass activity as well. Edit. Just read you already tried this.
BTW also try logging activity.get starting intent in activtyresume.
 
Thank you for your answer

BTW also try logging activity.get starting intent in activtyresume.
Already did this
Code: Copy
Sub Activity_Resume
  Dim In As Intent
  In = Activity.GetStartingIntent
  Log(In.HasExtra("result"))
The output is always false

I´ll try to implement this with inline java.
 
Back
Top