Drjacky / ImagePicker

📸Image Picker for Android, Pick images from Gallery or Capture a new image with Camera🖼
https://github.com/Drjacky/ImagePicker
Apache License 2.0
230 stars 57 forks source link

Screen Orientation Issue: Image Picker #109

Closed swapneshagrawal-tudip closed 6 months ago

swapneshagrawal-tudip commented 6 months ago

I am launching the image picker on the landscape mode of my tab application but as soon as It opens the camera and crops the image it changes to portrait mode. due to which my existing activity gets killed.

Any Suggestion to overcome this issue.

@Drjacky

Drjacky commented 6 months ago

Haven't tried but you need to have something like

<activity
        android:name="com.yalantis.ucrop.UCropActivity"
        android:screenOrientation="landscape"
        android:configChanges="orientation|screenSize|keyboardHidden" />

in your application, and then use merge manifest: https://developer.android.com/build/manage-manifests

swapneshagrawal-tudip commented 6 months ago

@Drjacky Heyy I took a clone of the repo and removed the android:screenOrientation="landscape" from Manifest and it worked. But I am using your repo as the dependency in my project. So I am not sure how to change the manifest file then. I tried to fork the repo and use my repo as dependency but it also did not worked.

Drjacky commented 6 months ago

without forking uCrop or ImagePicker repo; just have that ☝🏼 snippet in your app's AndroidManifest.xml. Then probably it compiles shows a manifest conflict error. So, you need to merge both AndroidManifests (https://developer.android.com/build/manage-manifests#override_uses-sdk_for_imported_libraries)

swapneshagrawal-tudip commented 6 months ago

@Drjacky Thanks a lot for the solution It Worked.