diff options
| author | smain@google.com <smain@google.com> | 2014-11-12 18:12:37 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2014-11-12 18:12:37 +0000 |
| commit | 0c217f9b8b1240d293fe55be76deb5cb1535a409 (patch) | |
| tree | ae44d1ac724c0db746b3d06b86e9edfc914a635e /docs/html | |
| parent | 42ec09fb2fa13c011af070f0de6cdb38c77c018c (diff) | |
| parent | be0737cdff2758a1dad4d65a070a9deb16913452 (diff) | |
am e9e96e7f: am 7d0d2f6c: am c6bd0155: am 8d88f19b: am f9c4f6b5: Merge "fix code type and mention api level 21 exception for bindService()" into lmp-docs
automerge: be0737c
* commit 'be0737cdff2758a1dad4d65a070a9deb16913452':
fix code type and mention api level 21 exception for bindService()
Diffstat (limited to 'docs/html')
| -rw-r--r-- | docs/html/guide/components/intents-filters.jd | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/html/guide/components/intents-filters.jd b/docs/html/guide/components/intents-filters.jd index 2f8c4078f404..3dec216f459d 100644 --- a/docs/html/guide/components/intents-filters.jd +++ b/docs/html/guide/components/intents-filters.jd @@ -139,7 +139,9 @@ only with an explicit intent.</p> intent when starting a {@link android.app.Service} and do not declare intent filters for your services. Using an implicit intent to start a service is a security hazard because you cannot be certain what service will respond to the intent, -and the user cannot see which service starts.</p> +and the user cannot see which service starts. Beginning with Android 5.0 (API level 21), the system +throws an exception if you call {@link android.content.Context#bindService bindService()} +with an implicit intent.</p> @@ -424,18 +426,18 @@ android.content.Intent#createChooser createChooser()} and pass it to {@link android.app.Activity#startActivity startActivity()}. For example:</p> <pre> -Intent intent = new Intent(Intent.ACTION_SEND); +Intent sendIntent = 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 intent to show chooser -Intent chooser = Intent.createChooser(intent, title); +// Create intent to show the chooser dialog +Intent chooser = Intent.createChooser(sendIntent, title); -// Verify the intent will resolve to at least one activity +// Verify the original intent will resolve to at least one activity if (sendIntent.resolveActivity(getPackageManager()) != null) { - startActivity(sendIntent); + startActivity(chooser); } </pre> |
