Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
In Android, the user can pass the data from one activity to another. We also get the result from destination activity in order to trigger an operation.
When we start an activity as a result, it is possible that it will destroy due to low memory. For this reason, the Activity Result APIs decouple the result callback from the place in your code where you launch the other activity.
When in a ComponentActivity or a Fragment, the Activity Result APIs provide a registerFoActivityResult() API for registering the result callback. registerFoActivityResult() takes an ActivityResultContract() and an ActivityResultCallBack and returns an ActivityResultLuancher() which you’ll use to launch the other activity.
If there are multiple activity calls, you can call registerForActivityResult() multiple times to register multiple ActivityResultLauncher. We must call registerForActivityResult() in the same order to ensure that the results are delivered to the correct callback.
Note:- It is strongly recommended to use the APIs When we have implemented LifecycleOwner. As the LifecycleOwner automatically removes your registered launcher when the Lifecycle is destroyed. And if a LifecycleOwner is not available, each ActivityResultLauncher class allows you to manually call unregister() as an alternative.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.