简体   繁体   中英

Conductor : Force Callback in onActivityResult

I am using Conductor in place of Fragment which gets attached to activity.

Scenario:

LocationConductor which has attached to MotherActivity . From LocationConductor , I am accessing GoogleApiClient which request for LocationRequest dialog.

From LocationConductor :

LocationSettingsResult.getStatus().startResolutionForResult(getActivity(), RC_LOCATION_SETTINGS);

It request LocationRequestDialog using GoogleApiClient which requires Activity Context. The CallBack from the Dialog will be back in onActivityResult of MotherActivity as Activity Context is passed.

Question :

  • I want that callback in to LocationConductor instead of MotherActivity. How can I force callback in conductor or pass conductor context while calling LocationRequest?

Tried :

  • registerForActivityResult(requestCode) : But neither does this help in forcing callback at Conductor.

registerForActivityResult : Registers this Controller to handle onActivityResult responses. Calling this method is NOT necessary when calling {@link #startActivityForResult(Intent, int)}

You can just call Router.onActivityResult() from within the activity's onActivityResult call to forward it along. If the activity itself calls startActivityForResult , there's no way to capture the results automatically. The same would go for fragments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM