Here’s an example.
Let’s say your app needs to take a photo. All you need to do is send the instruction to the device’s camera app. It will take the photo and return it to your app. Using startActivityForResult() is an easy way of doing that.
You can see how we did it in our camera app tutorial.
In this tutorial, I’ll use a simple app to show you how to use startActivityForResult () to get data from another activity.
The tutorial app
We’ll use startActivityForResult() to request data from two activities that we start. One will return some data while the other activity will cancel the request.
Let’s have a look at how it’s done.