dropInClient.launchDropInForResult allow Fragments or better registerForActivityResult
See original GitHub issueGeneral information
- SDK/Library version: 6.0.0.
- Environment: sandbox
- Android Version and Device: any
Issue description
dropInClient.launchDropInForResult()
requires Activity. But in this case startActivityForResult
is called on activity, not in attached fragment. So result is returned to activity and not into active fragment.
Expected behavior
launchDropInForResult
accept Fragments, so we can expect result in Fragment and not only in activity.
Or even better accept Activity Result APIs lambda function to handle result in callback through registerForActivityResult
. More info about Activity Result APIs:
https://developer.android.com/training/basics/intents/result
https://medium.com/e-legion/the-right-way-to-get-a-result-part-i-activity-result-api-6efbcaa5600d
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:13 (7 by maintainers)
Top Results From Across the Web
How to use registerForActivityResult correctly? Getting ...
Then use that activityLauncher variable to launch it from the button click listener. For more information, see the official guide.
Read more >Getting a result from an activity - Android Developers
registerForActivityResult() is safe to call before your fragment or activity is created, allowing it to be used directly when declaring member ...
Read more >StartActivityForResult is deprecated - Medium
I have found the registerForActivityResult useful and clean. Some of the pros, in my opinion, are: Improve the code readability, no need to...
Read more >Activity Result API: The Clean Way | by Prateek Batra
Why new Activity Result is better? ... launcher = registerForActivityResult ... Note: You must call registerForActivityResult() before the fragment or ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your patience everyone, this has been released in 6.1.0!
@fabiorbap apologies for this! We had a slight oversight. I’ve created a draft PR with the missing method.
It’s worth mentioning that if
DropInClient
is instantiated with either aFragment
orActivity
and a listener is set,launchDropInForResult(null, 0)
will work in the meantime.