IntentCompat
class IntentCompat
kotlin.Any | |
↳ | androidx.core.content.IntentCompat |
Helper for accessing features in android.content.Intent
.
Summary
Constants |
|
---|---|
static String |
Indicates an activity optimized for Leanback mode, and that should be displayed in the Leanback launcher. |
static String |
A constant String that is associated with the Intent, used with |
static String |
Used as a boolean extra field in |
Public methods |
|
---|---|
static Intent |
makeMainSelectorActivity(@NonNull selectorAction: String, @NonNull selectorCategory: String) Make an Intent for the main activity of an application, without specifying a specific activity to run but giving a selector to find the activity. |
Constants
CATEGORY_LEANBACK_LAUNCHER
static val CATEGORY_LEANBACK_LAUNCHER: String
Indicates an activity optimized for Leanback mode, and that should be displayed in the Leanback launcher.
Value: "android.intent.category.LEANBACK_LAUNCHER"
EXTRA_HTML_TEXT
static val EXTRA_HTML_TEXT: String
A constant String that is associated with the Intent, used with android.content.Intent#ACTION_SEND
to supply an alternative to android.content.Intent#EXTRA_TEXT
as HTML formatted text. Note that you must also supply android.content.Intent#EXTRA_TEXT
.
Value: "android.intent.extra.HTML_TEXT"
EXTRA_START_PLAYBACK
static val EXTRA_START_PLAYBACK: String
Used as a boolean extra field in android.content.Intent#ACTION_VIEW
intents to indicate that content should immediately be played without any intermediate screens that require additional user input, e.g. a profile selection screen or a details page.
Value: "android.intent.extra.START_PLAYBACK"
Public methods
makeMainSelectorActivity
@NonNull static fun makeMainSelectorActivity(@NonNull selectorAction: String, @NonNull selectorCategory: String): Intent
Make an Intent for the main activity of an application, without specifying a specific activity to run but giving a selector to find the activity. This results in a final Intent that is structured the same as when the application is launched from Home. For anything else that wants to launch an application in the same way, it is important that they use an Intent structured the same way, and can use this function to ensure this is the case.
The returned Intent has Intent#ACTION_MAIN
as its action, and includes the category Intent#CATEGORY_LAUNCHER
. This does not have Intent#FLAG_ACTIVITY_NEW_TASK
set, though typically you will want to do that through Intent#addFlags(int)
on the returned Intent.
Parameters | |
---|---|
selectorAction |
String: The action name of the Intent's selector. |
selectorCategory |
String: The name of a category to add to the Intent's selector. |
Return | |
---|---|
Intent: Returns a newly created Intent that can be used to launch the activity as a main application entry. |