From b33940abca9d43891575f58a1107c8ec247afed1 Mon Sep 17 00:00:00 2001
From: Doug Kramer
When the user takes an action on some data, such as touching a
mailto:info@example.com link, they are actually initiating an Intent
- object which then gets resolved to a particular component (we will
- consider only activity components here). So, the result of a user
- touching a mailto: link is an Intent object that the system tries to
- match to an activity. If that Intent object was written explicitly
- naming an activity (an explicit intent), then the system
- immediately launches that activity in response to the user
+ object, or just an intent, which then gets resolved to a
+ particular component (we consider only activity components here).
+ So, the result of a user touching a mailto: link is an Intent object
+ that the system tries to match to an activity. If that Intent object was
+ written explicitly naming an activity (an explicit intent),
+ then the system immediately launches that activity in response to the user
action. However, if that Intent object was written without naming an
activity (an implicit intent), the system compares the Intent
object to the intent filters of available activities. If more
@@ -872,12 +871,29 @@ page.title=Activity and Task Design Guidelines
Your applications can re-use activities made available from other
- applications. In doing so, you cannot presume that external activity
- will always be present — you must handle the case that the
- external activity is not installed. Do this in the way you find most
- appropriate, such as dimming the user control that accesses it (such
- as a button or menu item), or displaying a message to the user that
- sends them to the location to download it, such as the Market.
+ applications. In doing so, you cannot presume your intent will always
+ be resolved to a matching external activity — you must handle the case
+ where no application installed on the device can handle the intent.
+
+ You can either test that an activity matches the intent, which you can do
+ before starting the activity, or catch an exception if starting the
+ activity fails. Both approaches are descibed in the blog posting
+ Can
+ I use this Intent?.
+
+ To test whether an intent can be resolved, your code can query the package manager.
+ The blog post provides an example in the isIntentAvailable() helper method.
+ You can perform this test when initializing the user interface.
+ For instance, you could disable the user control that initiates
+ the Intent object, or display a message to the user that lets them go
+ to a location, such as the Market, to download its application.
+ In this way, your code can start the activity (using either startActivity()
+ or startActivityForResult()) only if the intent has tested to resolve
+ to an activity that is actually present.
@@ -49,7 +49,6 @@ page.title=Activity and Task Design Guidelines
@@ -630,12 +629,12 @@ page.title=Activity and Task Design Guidelines
Consider how you want your activities to be launched or used by other applications
@@ -1054,15 +1070,14 @@ page.title=Activity and Task Design Guidelines
- Applications that are in the background or haven't been run can - send out notifications to the user letting them know about events - of interest. For example, Calendar can send out notifications of - upcoming events, and Email can send out notifications when new - messages arrive. One of the user interface rules is that when the - user is in activity A and gets a notification for activity B and +
+ Applications that are in the background or not running can have + services that send out notifications to the user letting them know about + events of interest. Two examples are Calendar, which can send out notifications of + upcoming events, and Email, which can send out notifications when new + messages arrive. One of the user interface guidelines is that when the + user is in activity A, gets a notification for activity B and picks that notification, when they press the BACK key, they should go back to activity A.
@@ -1108,11 +1123,11 @@ Notifications generally happen primarily in one of two ways:There are other ways to handle notifications, such as bringing the - activity to the foreground set to display specific data, such as the - ongoing text message thread of a particular person. + activity to the foreground, set to display specific data, such as + displaying the text message thread for the person who just sent a + new text message.
-- cgit v1.2.3-59-g8ed1b