Giter Site home page Giter Site logo

Comments (6)

ocram avatar ocram commented on May 21, 2024 1

Thanks a lot!

This library has only been tested in normal Activity classes so far. But in FragmentActivity, which you used, there is an additional condition:

public void startActivityForResult(Intent intent, int requestCode) {
    if (requestCode != -1 && (requestCode&0xffff0000) != 0) {
        throw new IllegalArgumentException("Can only use lower 16 bits for requestCode");
    }
    super.startActivityForResult(intent, requestCode);
}

So we'll just have to change the hard-coded request code to a lower value.

from android-advancedwebview.

Whyser avatar Whyser commented on May 21, 2024

Nice that you realized that it was related to Fragments (I didn't know that)!

Not sure if this is also related, but fragments "public void onActivityResult (int requestCode, int resultCode, Intent intent)" won't get called, so one has to forward from the parent activity to the correct fragment. (I'm not very experienced Android developer so not sure what the correct/expected behaviour should be in that scenario)

from android-advancedwebview.

ocram avatar ocram commented on May 21, 2024

The issue should have been fixed with the following commit now: 90c3937

Can you please try the updated JAR and report if it works?

Regarding your other issue, please make sure that you don't call getActivity().startActivityForResult() but simply startActivityForResult() and then implement onActivityResult() in the Fragment subclass.

from android-advancedwebview.

Whyser avatar Whyser commented on May 21, 2024

It seems to work, thank you!

Regarding my other issue. I'm never calling the startActivityResult(), it's called inside AdvancedWebView.java, in openFileInput(...). Which will only call onActivityResult() in my ActionBarActivity.java (which contain the fragments).

ActionBarActivity.java:

@Override
public void onActivityResult (int requestCode, int resultCode, Intent intent) {
   if(mFragment != null) 
       mFragment.onActivityResult(requestCode, resultCode, intent);
}

from android-advancedwebview.

ocram avatar ocram commented on May 21, 2024

You're right, sorry. So onActivityResult will, rightly, never be called inside your Fragment but only in the Activity. Can you please open a new issue for the problem that one has to forward from the Activity to the correct Fragment? Thanks!

from android-advancedwebview.

anilthummar avatar anilthummar commented on May 21, 2024

@ocram
Hello Oracam ,

I am working on google fit api integration in my android application , i am getting following error ,
Please help me. Thanks.

i used fitness dependency.

Process: com.alaramdemosample, PID: 16857
java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
at android.support.v4.app.BaseFragmentActivityGingerbread.checkForValidRequestCode(BaseFragmentActivityGingerbread.java:88)
at android.support.v4.app.BaseFragmentActivityGingerbread.startIntentSenderForResult(BaseFragmentActivityGingerbread.java:75)
at android.support.v4.app.FragmentActivity.startIntentSenderForResult(FragmentActivity.java:77)
at com.google.android.gms.common.ConnectionResult.startResolutionForResult(Unknown Source)
at com.google.android.gms.common.api.internal.zzw$zzb.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5896)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

Please help me.

from android-advancedwebview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.