Lesson 4 - Intents Flashcards
Intents
messaging objects; let an app request that an action take place; e.g. start new activity, display photo, make a call, etc.
Intents metaphor
“envelopes”; who (which component) to send to, bit of data - packaged as EXTRAs (primitive tuples)
explicit intent
includes name of target component
add activity how?
dropdown menu for new activity, or file->new file
add data to intent how?
put extra; stuffs data into intent
putExtra() data retrieved how?
key, value; like JSON. putExtra(String name, String value)
putExtra() String, String example
startChildActivityIntent.putExtra(Intent.EXTRA_TEXT, textEntered);
how to get intent that created this activity; “get envelope”
getIntent();
get string out of Intent; “open envelope”
getStringExtra(String name)
explicit intent is?
where we know exactly what activity to start
how to make explicit intent?
Intent(context, classOfActivityToStart)
implicit intent is?
where we don’t know or care how our request will be fulfilled
how to find examples of most used intents?
“common intents”
URI?
like an address to data
intent to launch website?
Intent(Intent.ACTION_VIEW, webpageUri)