Java Question How to implement onActivityResult in a wrapper?

Discussion in 'Libraries developers questions' started by DonManfred, Jul 2, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    public void CreatePayment(int amount, String orderID, String description, String emailString 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(
    if (!TextUtils.isEmpty(email)) {
        TransactionRequest request = builder.createTransactionRequest();
        //PaylevenApi.initiatePayment(this.getParent(), orderID, request);
        PaylevenApi.initiatePayment(ba.activity, orderID, request);
    When executing
    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.

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

        protected void onActivityResult(int requestCode, int resultCode, 
    Intent data) {
    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?

    Attached Files:

  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    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.
    DonManfred and NJDude like this.
  3. DonManfred

    DonManfred Expert Licensed User

    Thank you for your answer

    Already did this
    Sub Activity_Resume
    Dim In As Intent
    In = Activity.GetStartingIntent
    The output is always false

    I´ll try to implement this with inline java.
    lemonisdead likes this.
  4. Erel

    Erel Administrator Staff Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice