Fix: Prevent ActivityResultLauncher crash by moving registration to onCreate#6655
Open
Kota-Jagadeesh wants to merge 2 commits intocommons-app:mainfrom
Open
Fix: Prevent ActivityResultLauncher crash by moving registration to onCreate#6655Kota-Jagadeesh wants to merge 2 commits intocommons-app:mainfrom
Kota-Jagadeesh wants to merge 2 commits intocommons-app:mainfrom
Conversation
Collaborator
|
Thanks @Kota-Jagadeesh, I'll test and review this PR by this weekend. |
|
✅ Generated APK variants! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (required)
Fixes #6654
What changes did you make and why?
This PR fixes an
IllegalStateException: Attempting to launch an unregistered ActivityResultLaunchercrash. This crash occurs if a user selects multiple images for upload, deletes one of them during the media details step, and then tries to click the "Edit Image" button.for fixing thhis, i moved the
registerForActivityResultcalls directly into theonCreate()method. This guaranteees the launchers are properly registered with the androidd system's lifecycle every time the fragment is created, preventing the crashTests performed (required)
Tested ProDebug on Redmi NOte 13 Pro with API level 35.
Screenshots (for UI changes only)
a lifecycle crash fix.
Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.