diff options
Diffstat (limited to 'docs/html/training/basics')
-rw-r--r-- | docs/html/training/basics/intents/filters.jd | 4 | ||||
-rw-r--r-- | docs/html/training/basics/intents/sending.jd | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/docs/html/training/basics/intents/filters.jd b/docs/html/training/basics/intents/filters.jd index 9b6a111..10bf43d 100644 --- a/docs/html/training/basics/intents/filters.jd +++ b/docs/html/training/basics/intents/filters.jd @@ -148,8 +148,8 @@ the recipient's address using the {@code send} or {@code sendto} URI scheme. For {@link android.content.Intent#CATEGORY_DEFAULT} category in the intent filter. The methods {@link android.app.Activity#startActivity startActivity()} and {@link android.app.Activity#startActivityForResult startActivityForResult()} treat all intents as if they -contained the {@link android.content.Intent#CATEGORY_DEFAULT} category. If you do not declare it, no -implicit intents will resolve to your activity.</p> +declared the {@link android.content.Intent#CATEGORY_DEFAULT} category. If you do not declare it +in your intent filter, no implicit intents will resolve to your activity.</p> <p>For more information about sending and receiving {@link android.content.Intent#ACTION_SEND} intents that perform social sharing behaviors, see the lesson about <a diff --git a/docs/html/training/basics/intents/sending.jd b/docs/html/training/basics/intents/sending.jd index 79c017b..30dc95a 100644 --- a/docs/html/training/basics/intents/sending.jd +++ b/docs/html/training/basics/intents/sending.jd @@ -241,9 +241,13 @@ Intent intent = new Intent(Intent.ACTION_SEND); // Always use string resources for UI text. // This says something like "Share this photo with" String title = getResources().getString(R.string.chooser_title); -// Create and start the chooser +// Create intent to show chooser Intent chooser = Intent.createChooser(intent, title); -startActivity(chooser); + +// Verify the intent will resolve to at least one activity +if (intent.resolveActivity(getPackageManager()) != null) { + startActivity(chooser); +} </pre> <p>This displays a dialog with a list of apps that respond to the intent passed to the {@link |