0
我在onActionResult裏面有一個DialogFragment子類的問題。 onActionResult不會被調用,但會調用啓動DialogFragment的Activity。Android:onActionResult裏面的DialogFragment不叫
調用的是此AppCompatActivity A - > DialogFragment - > AppCompatActivity B 預期的結果是AppCompatActivity B將結果發送回DialogFragment。
我有與上述相同的過程,但是改爲AppCompatActivity A,它是Fragment和該部分工作。
這是我下面的代碼來顯示DialogFragment:
if (getContext() instanceof AppCompatActivity) {
FragmentManager manager = ((AppCompatActivity) getContext()).getSupportFragmentManager();
AttachmentOptionDialog imgAttachment = AttachmentOptionDialog.newInstance(dialogListener);
imgAttachment.setTargetFragment(imgAttachment, MobileConstant.newInstance().REQUEST_CODE_PROFILE_PHOTO);
imgAttachment.show(manager, "");
}
調用活動B:
v.setEnabled(false);
Intent intent = new Intent();
intent.setClass(getActivity(), CameraActivity.class);
startActivityForResult(intent, MobileConstant.newInstance().REQUEST_CODE_CAMERA);
[onActivityResult未在片段中調用]的可能重複(http://stackoverflow.com/questions/6147884/onactivityresult-not-being-called-in-fragment) – mikejonesguy