如何在我的片段中调用public static void startPhotoPickActivity(片段片段,EZPhotoPickConfig配置)?

时间:2019-07-03 03:44:00

标签: java android android-fragments

如何在片段中调用public static void startPhotoPickActivity(Fragment fragment, EZPhotoPickConfig config)

public static void startPhotoPickActivity(Fragment fragment, EZPhotoPickConfig config) throws PhotoIntentException {
    Activity activity = fragment.getActivity();
    if(activity == null){
        throw new PhotoIntentException("Can not find the host activity of fragment");
    }
    Intent intent = new Intent(fragment.getContext(), PhotoIntentHelperActivity.class);
    int orientation = getScreenOrientation(activity);
    intent.putExtra(PhotoIntentConstants.PHOTO_PICK_CONFIG_KEY, config);
    intent.putExtra(PhotoIntentConstants.SCREEN_ORIENTATION, orientation);
    int requestCode = config.photoSource == PhotoSource.GALLERY ? PHOTO_PICK_GALLERY_REQUEST_CODE : PHOTO_PICK_CAMERA_REQUEST_CODE;
    fragment.startActivityForResult(intent, requestCode);
    activity.overridePendingTransition(0, 0);
}

0 个答案:

没有答案
相关问题