Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
For the More Curious: startActivityForResult
This chapter uses the Activity Result APIs to start and pass information back from CheatActivity. These APIs are a relatively recent addition to Android. They were actually built on top of existing APIs: the startActivityForResult() function and onActivityResult() callback. We recommend using the Activity Result APIs, as they enable you to consume type-safe results and they encourage developers to write more modular code – but you might see applications that call the older, lower-level APIs directly.
There are many parallels between these two approaches.
The startActivityForResult() function is analogous to the launch(Intent) function you used on cheatLauncher. The one additional parameter ...
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