Since Android came into existence in 2007, Activity
has been one of its core components. One of the most common tasks in apps is transferring data between two Activities. Until now, Intents
and onActivityResult
were the only choice.
Through the combination of these two parts, developers are able to transfer data from one Activity
to another and get data back easily.
Let’s elaborate through an example: your app wants to capture an image and display it to the user. You either write your own custom Camera or delegate the task of fetching an image to Android through Intents
. In this second scenario, Android system will open the user-preferred Camera app, capture the image and deliver the requested data to your activity by calling onActivityResult()
method.