06 Intents
06 Intents
Intents
Luca Bedogni
Dipartimento di Scienze dell’Informazione
Università di Bologna
Outline
What is an intent?
Intent description
Intent-Resolution process
Ø Paused
Ø Lost focus but still visible
Ø Can be killed by the system in extreme situations
Ø Stopped
Ø Completely obscured by another activity
Ø Killed if memory is needed somewhere else
Luca Bedogni - Programming with Android – Intents 3
More on Activities: Saving resources
Component Name
Action Name
Data
Structure
of an Intent Category
Extra Flags
INTENT TYPES
EXPLICIT IMPLICIT
INTENT TYPES
EXPLICIT IMPLICIT
Ø scheme://host:port/path
EXAMPLEs
tel://003-232-234-678
content://contacts/people
http://www.cs.unibo.it/
Component Name
Action Name
Data Additional information that
instructs Android how to launch
Category an activity, and how to treat it
Extra Flags after executed.
Intent i = new
Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://informatica.unibo.it"));
startActivity(i);
Ø How?
<intent-filter>
<action android:name=”my.project.ACTION_ECHO” />
</intent-filter>
<intent-filer … >
<action android:name=“com.example.it.ECHO”/>
</intent-filter>
Luca Bedogni - Programming with Android – Intents 31
Intent types: Intent Resolution
<intent-filer … >
<category android:name=“android.intent.category.DEFAULT”/>
</intent-filter>