Learning Android™ Application Programming: A Hands-On Guide to Building Android Applications
by James Talbot, Justin McLean, Jorge Hernandez
Getting Results from Activities
The next step is to display the photo in your app. To do this, you need to look a little deeper into intents. At this point, you’ve already started a new activity via the startActivity method, but there is also a startActivityForResult method. You can call this method to tell you when an activity has ended and what has happened, and you can use it to pass data between activities. You can pass data to activities that you have created or even to native Android activities such as the camera.
To use the startActivityForResult method, you pass the Intent and an extra parameter of type integer. This is known as the request code. When this new activity finishes, it will return the request code you have sent, along with ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access