Skip to content

Most visited

Recently visited

navigation
added in version 22.1.0
belongs to Maven artifact com.android.support:support-compat:27.0.0

IntentCompat

public final class IntentCompat
extends Object

java.lang.Object
   ↳ android.support.v4.content.IntentCompat


Helper for accessing features in Intent.

Summary

Constants

String CATEGORY_LEANBACK_LAUNCHER

Indicates an activity optimized for Leanback mode, and that should be displayed in the Leanback launcher.

String EXTRA_HTML_TEXT

A constant String that is associated with the Intent, used with ACTION_SEND to supply an alternative to EXTRA_TEXT as HTML formatted text.

String EXTRA_START_PLAYBACK

Used as a boolean extra field in ACTION_VIEW intents to indicate that content should immediately be played without any intermediate screens that require additional user input, e.g.

Public methods

static Intent makeMainSelectorActivity(String selectorAction, String selectorCategory)

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.

Inherited methods

From class java.lang.Object

Constants

CATEGORY_LEANBACK_LAUNCHER

added in version 24.1.0
String CATEGORY_LEANBACK_LAUNCHER

Indicates an activity optimized for Leanback mode, and that should be displayed in the Leanback launcher.

Constant Value: "android.intent.category.LEANBACK_LAUNCHER"

EXTRA_HTML_TEXT

added in version 22.1.0
String EXTRA_HTML_TEXT

A constant String that is associated with the Intent, used with ACTION_SEND to supply an alternative to EXTRA_TEXT as HTML formatted text. Note that you must also supply EXTRA_TEXT.

Constant Value: "android.intent.extra.HTML_TEXT"

EXTRA_START_PLAYBACK

added in version 25.4.0
String EXTRA_START_PLAYBACK

Used as a boolean extra field in 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.

Constant Value: "android.intent.extra.START_PLAYBACK"

Public methods

makeMainSelectorActivity

added in version 22.1.0
Intent makeMainSelectorActivity (String selectorAction, 
                String selectorCategory)

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 ACTION_MAIN as its action, and includes the category CATEGORY_LAUNCHER. This does not have FLAG_ACTIVITY_NEW_TASK set, though typically you will want to do that through 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.

Returns
Intent Returns a newly created Intent that can be used to launch the activity as a main application entry.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)