我使用导体代替与活动相关的片段。
设想情况:
LocationConductor,附在MotherActivity上。从LocationConductor,我访问请求LocationRequest对话框的GoogleApiClient。
来自LocationConductor:
LocationSettingsResult.getStatus().startResolutionForResult(getActivity(), RC_LOCATION_SETTINGS);它使用需要LocationRequestDialog上下文的GoogleApiClient请求Activity。对话框中的CallBack将在传递onActivityResult of MotherActivity上下文时返回Activity。
问题:
试过:
registerForActivityResult : Registers this Controller to handle onActivityResult responses. Calling this method is NOT necessary when calling {@link #startActivityForResult(Intent, int)}
发布于 2018-08-24 17:34:50
您只需从活动的Router.onActivityResult()调用中调用onActivityResult来转发它。如果活动本身调用startActivityForResult,则无法自动捕获结果。碎片也是如此。
https://stackoverflow.com/questions/51997508
复制相似问题