Open the camera directly
masterThere are three ways to trigger the camera immediately instead of opening the gallery:
- Via
GalleryConfig: Set.isOpenCamera(true)during configuration. - Via Builder modification: If you already have a
GalleryConfiginstance, use.getBuilder().isOpenCamera(true).build()to create a modified version. - Via direct method call: Use the convenience method
openCamera(mActivity)on theGalleryPickinstance. This is the simplest method as it does not require modifying the existingGalleryConfig.
// Method 1: In Builder
GalleryConfig galleryConfig = new GalleryConfig.Builder()
.iHandlerCallBack(iHandlerCallBack)
.isOpenCamera(true)
.build();
GalleryPick.getInstance().setGalleryConfig(galleryConfig).open(mActivity);
// Method 2: Modify existing config
galleryConfig.getBuilder().isOpenCamera(true).build();
GalleryPick.getInstance().setGalleryConfig(galleryConfig).open(mActivity);
// Method 3: Direct call (Recommended for convenience)
GalleryPick.getInstance().setGalleryConfig(galleryConfig).openCamera(mActivity);