Using Implicit Intents

An Intent is an object that describes to the OS something that you want it to do. With the explicit intents that you have created thus far, you explicitly name the activity that you want the OS to start.

I​n​t​e​n​t​ ​i​n​t​e​n​t​ ​=​ ​n​e​w​ ​I​n​t​e​n​t​(​g​e​t​A​c​t​i​v​i​t​y​(​)​,​ ​C​r​i​m​e​P​a​g​e​r​A​c​t​i​v​i​t​y​.​c​l​a​s​s​)​;​
i​n​t​e​n​t​.​p​u​t​E​x​t​r​a​(​E​X​T​R​A​_​C​R​I​M​E​_​I​D​,​ ​c​r​i​m​e​I​d​)​;​
s​t​a​r​t​A​c​t​i​v​i​t​y​(​i​n​t​e​n​t​)​;​

With an implicit intent, you describe to the OS the job that you want done. The OS then starts the activity that has advertised itself as capable of doing that job. If the OS finds more than one capable activity, then the user is offered a choice. ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.