Cloneable, Sequenceablepublic class Intent extends Object implements Sequenceable, Cloneable
Intent is the basic communication component of the system. It encapsulates the intention
and parameters for a method call.The Intent can be used in
Ability.startAbility(Intent)to start an
Ability. The system has defined a variety of standard intent action
and category constants in the Intent class.
operation -- Encapsulates particular parameters and operations related to an Intent.
parameters -- Indicates the additional parameters passed to an Ability.
IntentAn Intent can be called in two ways. You can specify the fully qualified name of an ability
in an Intent to start the specified ability of a particular application, or set attributes in
the operation attribute of an Intent to start an application that meets the specified attribute settings.
IntentParamsSystemCapability.Aafwk#INTENT| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
Intent.OperationBuilder |
Builder class for creating an
Operation instance. |
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static String |
ACTION_BOOK_FLIGHT |
Indicates the action of booking a flight.
|
static String |
ACTION_BOOK_HOTEL |
Indicates the action of booking a hotel.
|
static String |
ACTION_BOOK_TRAIN_TICKET |
Indicates the action of booking a train ticket.
|
static String |
ACTION_BUNDLE_ADD |
Indicates the action of installing a bundle.
|
static String |
ACTION_BUNDLE_REMOVE |
Indicates the action of uninstalling a bundle.
|
static String |
ACTION_BUNDLE_UPDATE |
Indicates the action of updating a bundle.
|
static String |
ACTION_BUY |
Indicates the action of shopping.
|
static String |
ACTION_BUY_TAKEOUT |
Indicates the action of ordering take-out food.
|
static String |
ACTION_HOME |
Indicates the action of backing home.
|
static String |
ACTION_LOCALE_CHANGED |
Indicates that the locale has changed.
|
static String |
ACTION_ORDER_TAXI |
Indicates the action of booking a taxi.
|
static String |
ACTION_PLAN_ROUTE |
Indicates the action of querying routes.
|
static String |
ACTION_PLAY |
Indicates the action of playing a media item.
|
static String |
ACTION_QUERY_ALMANC |
Indicates the action of querying the Chinese Almanac calendar.
|
static String |
ACTION_QUERY_CONSTELLATION_FORTUNE |
Indicates the action of querying horoscope.
|
static String |
ACTION_QUERY_ENCYCLOPEDIA |
Indicates the action of querying the encyclopedia.
|
static String |
ACTION_QUERY_JOKE |
Indicates the action of reading jokes.
|
static String |
ACTION_QUERY_LOGISTICS_INFO |
Indicates the action of tracking shipment status.
|
static String |
ACTION_QUERY_NEWS |
Indicates the action of browsing news.
|
static String |
ACTION_QUERY_POI_INFO |
Indicates the action of querying nearby places.
|
static String |
ACTION_QUERY_RECIPE |
Indicates the action of searching for a recipe.
|
static String |
ACTION_QUERY_SPORTS_INFO |
Indicates the action of querying sports teams and game schedule.
|
static String |
ACTION_QUERY_STOCK_INFO |
Indicates the action of querying stock market quotes.
|
static String |
ACTION_QUERY_TRAFFIC_RESTRICTION |
Indicates the action of querying driving bans.
|
static String |
ACTION_QUERY_TRAVELLING_GUIDELINE |
Indicates the action of querying a travel guide.
|
static String |
ACTION_QUERY_WEATHER |
Indicates the action of querying weather.
|
static String |
ACTION_SEND_LOGISTICS |
Indicates the action of shipping a bundle.
|
static String |
ACTION_TRANSLATE_TEXT |
Indicates the action of translating text.
|
static String |
ACTION_WATCH_VIDEO_CLIPS |
Indicates the action of watching video clips.
|
static int |
CLONE_ACTION |
Indicates that the
action attribute will be copied. |
static int |
CLONE_BORDERS_RECT |
Indicates that the
BORDERS_RECT attribute will be copied. |
static int |
CLONE_BUNDLE |
Indicates that the
bundle attribute will be copied. |
static int |
CLONE_ELEMENT |
Indicates that the
element attribute will be copied. |
static int |
CLONE_ENTITIES |
Indicates that the
entities attribute will be copied. |
static int |
CLONE_PICKER |
Indicates that the
picker attribute will be copied. |
static int |
CLONE_URI |
Indicates that the
uri attribute will be copied. |
static String |
ENTITY_HOME |
Indicates the home screen category.
|
static String |
ENTITY_VIDEO |
Indicates the video category.
|
static int |
FLAG_ABILITY_CLEAR_MISSION |
Indicates the operation of clearing other missions.
|
static int |
FLAG_ABILITY_CONTINUATION |
Determines whether an ability on the local device can be migrated to a remote device.
|
static int |
FLAG_ABILITY_FORM_ENABLED |
Specifies whether an ability is started.
|
static int |
FLAG_ABILITY_FORWARD_RESULT |
Returns the result to the source ability.
|
static int |
FLAG_ABILITY_MISSION_TOP |
Indicates that the existing instance of the ability to start will be reused if it is already at the top of
the mission stack.
|
static int |
FLAG_ABILITY_NEW_MISSION |
Indicates the operation of creating a task on the historical mission stack.
|
static int |
FLAG_ABILITYSLICE_FORWARD_RESULT |
Returns the result to the source ability slice.
|
static int |
FLAG_ABILITYSLICE_MULTI_DEVICE |
Supports multi-device startup in the distributed scheduling system.
|
static int |
FLAG_INSTALL_ON_DEMAND |
Install the specified ability if it's not installed.
|
static int |
FLAG_INSTALL_WITH_BACKGROUND_MODE |
Install the specifiedi ability with background mode if it's not installed.
|
static int |
FLAG_NOT_OHOS_COMPONENT |
Specifies whether a component does not belong to OHOS.
|
static int |
FLAG_START_FOREGROUND_ABILITY |
Indicates that an ability using the Service template is started regardless of whether the host application has
been started.
|
static Sequenceable.Producer<Intent> |
PRODUCER |
Creates a
Intent instance from a Parcel. |
| 构造器 | 说明 |
|---|---|
Intent() |
A constructor used to create an empty
Intent instance. |
Intent(Intent intent) |
A constructor used to create an
Intent instance by using the parameters of an existing
Intent object. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
Intent |
addEntity(String entity) |
已过时。
This change is effective since API version 5.
Replaced by
OperationBuilder#withEntities(Set). |
Intent |
addFlags(int flags) |
Adds a flag to an
Intent. |
Object |
clone() |
Clones this
Intent object. |
int |
cloneByIntent(Intent other,
int flags) |
Copies the attributes of a specified
Intent. |
Intent |
cloneOperation() |
Creates an
Intent object that contains only the operation component of this Intent. |
int |
countEntities() |
Obtains the number of entities in an
Intent. |
static Intent |
createSelectIntent(Intent target,
CharSequence title) |
Creates an
Intent instance that is intended to open an application selection dialog box based on the
specified Intent object. |
boolean |
equals(Object other) |
Indicates whether some other object is "equal to" this one.
|
static String |
formatMimeType(String mimeType) |
Formats data of a specified MIME type.
|
Intent |
formatType(String type) |
Formats a specified MIME type.
|
Intent |
formatUri(Uri uri) |
Formats a specified URI.
|
Intent |
formatUriAndType(Uri uri,
String type) |
Formats a specified URI and MIME type.
|
String |
getAction() |
Obtains the description of an action in an
Intent. |
boolean[] |
getBooleanArrayParam(String key) |
Obtains a boolean array matching the given key.
|
boolean |
getBooleanParam(String key,
boolean defaultValue) |
Obtains a boolean value matching the given key.
|
Rect |
getBordersRect() |
Obtains the
bordersRect attribute of this Intent. |
String |
getBundle() |
Obtains the name of the bundle specified in an
Intent. |
byte[] |
getByteArrayParam(String key) |
Obtains a byte-type array matching the given key.
|
byte |
getByteParam(String key,
byte defaultValue) |
Obtains a byte-type value matching the given key.
|
char[] |
getCharArrayParam(String key) |
Obtains a char array matching the given key.
|
char |
getCharParam(String key,
char defaultValue) |
Obtains a char value matching the given key.
|
ArrayList<CharSequence> |
getCharSequenceArrayListParam(String key) |
Obtains an
ArrayList parameter value of CharSequence elements that matches the given key. |
CharSequence[] |
getCharSequenceArrayParam(String key) |
Obtains a CharSequence array matching the given key.
|
CharSequence |
getCharSequenceParam(String key) |
Obtains a CharSequence value matching the specified key.
|
double[] |
getDoubleArrayParam(String key) |
Obtains a double array matching the given key.
|
double |
getDoubleParam(String key,
double defaultValue) |
Obtains a double value matching the given key.
|
ElementName |
getElement() |
Obtains the description of the
ElementName object in an Intent. |
Set<String> |
getEntities() |
Obtains the description of all entities in an
Intent. |
int |
getFlags() |
Obtains the description of flags in an
Intent. |
float[] |
getFloatArrayParam(String key) |
Obtains a float array matching the given key.
|
float |
getFloatParam(String key,
float defaultValue) |
Obtains a float value matching the given key.
|
int[] |
getIntArrayParam(String key) |
Obtains an int array matching the given key.
|
ArrayList<Integer> |
getIntegerArrayListParam(String key) |
Obtains an
ArrayList parameter value of Integer elements that matches the given key. |
int |
getIntParam(String key,
int defaultValue) |
Obtains an int value matching the given key.
|
long[] |
getLongArrayParam(String key) |
Obtains a long array matching the given key.
|
long |
getLongParam(String key,
long defaultValue) |
Obtains a long value matching the given key.
|
Operation |
getOperation() |
Gets the description of an operation in an
Intent. |
IntentParams |
getParam(String key) |
Obtains an
IntentParams value matching the given key. |
IntentParams |
getParams() |
Obtains the description of the
IntentParams object in an Intent. |
<T extends Sequenceable> |
getParcelableArrayListParam(String key) |
已过时。
This change is effective since API version 5.
Replaced by
getSequenceableArrayListParam(java.lang.String) |
Sequenceable[] |
getParcelableArrayParam(String key) |
已过时。
This change is effective since API version 5. Replaced by
getSequenceableArrayParam(java.lang.String) |
<T extends Sequenceable> |
getParcelableParam(String key) |
已过时。
This change is effective since API version 5. Replaced by
getSequenceableParam(java.lang.String) |
Intent |
getPicker() |
Obtains the description of the picker
Intent in this Intent. |
String |
getScheme() |
Obtains the description of the URI scheme in this
Intent. |
<T extends Sequenceable> |
getSequenceableArrayListParam(String key) |
Obtains an
ArrayList parameter value of Sequenceable elements that matches the given key. |
Sequenceable[] |
getSequenceableArrayParam(String key) |
Obtains a
Sequenceable array matching the given key. |
<T extends Sequenceable> |
getSequenceableParam(String key) |
Obtains a Sequenceable value matching the specified key.
|
<T extends Serializable> |
getSerializableParam(String key) |
Obtains a
Serializable parameter value matching the given key. |
short[] |
getShortArrayParam(String key) |
Obtains a short array matching the given key.
|
short |
getShortParam(String key,
short defaultValue) |
Obtains a short value matching the given key.
|
ArrayList<String> |
getStringArrayListParam(String key) |
Obtains an
ArrayList parameter value of String elements that matches the given key. |
String[] |
getStringArrayParam(String key) |
Obtains a string array matching the given key.
|
String |
getStringParam(String key) |
Obtains a string value matching the given key.
|
String |
getType() |
Obtains the description of the type in this
Intent. |
Uri |
getUri() |
Obtains the description of a URI in an
Intent. |
String |
getUriString() |
Obtains the string representation of the URI in this
Intent. |
boolean |
hasEntity(String entity) |
Checks whether an
Intent contains the given entity. |
int |
hashCode() |
Returns a hash code value for the object.
|
boolean |
hasParameter(String key) |
Checks whether an
Intent contains the parameter matching a given key. |
static Intent |
makeMainAbility(ElementName elementName) |
Creates an
Intent with its corresponding attributes specified for
starting the main ability of an application. |
static Intent |
makeMainAbilityPicker(String pickerAction,
String pickerEntity) |
Creates an
Intent with its picker Intent attributes specified for starting the main ability of an
application. |
static Intent |
makeRestartAbilityMission(ElementName elementName) |
Creates an
Intent object and sets related flags for restarting a particular ability. |
boolean |
marshalling(Parcel out) |
Marshals an
Intent into a Parcel. |
boolean |
operationEquals(Intent other) |
Checks whether the operation component of this
Intent equals that of the specified
Intent object. |
int |
operationHashCode() |
Obtains the sum of hash codes of all sub-attributes contained in the
operation
attribute of this Intent object. |
static Intent |
parseUri(String uri) |
Creates an
Intent instance by using a given Uniform Resource Identifier (URI). |
void |
removeEntity(String entity) |
Removes the description of an entity from an
Intent. |
void |
removeFlags(int flags) |
Removes the description of a flag from an
Intent. |
void |
removeParam(String key) |
Removes the parameter matching the given key.
|
Intent |
replaceParams(Intent intent) |
Replaces parameters in this
Intent object with those in the given Intent object. |
Intent |
replaceParams(IntentParams intentParams) |
Replaces parameters in this
Intent object with those in the given IntentParams object. |
Intent |
setAction(String action) |
已过时。
This change is effective since API version 5.
Replaced by
OperationBuilder#withAction(String). |
void |
setBordersRect(Rect rect) |
Sets the
bordersRect attribute for this Intent. |
Intent |
setBundle(String bundleName) |
Sets a bundle name in this
Intent. |
Intent |
setCharSequenceArrayListParam(String key,
ArrayList<CharSequence> value) |
Sets a parameter value of the
ArrayList type whose element type is CharSequence. |
Intent |
setElement(ElementName element) |
Sets an
ElementName object in an Intent. |
Intent |
setElementName(String bundleName,
Class<?> cls) |
Sets the
bundleName and abilityName attributes for this Intent. |
Intent |
setElementName(String bundleName,
String abilityName) |
Sets the
bundleName and abilityName attributes for this Intent object. |
Intent |
setElementName(String deviceId,
String bundleName,
Class<?> cls) |
Sets the
deviceId, bundleName, and abilityName attributes for this Intent. |
Intent |
setElementName(String deviceId,
String bundleName,
String abilityName) |
Sets the
deviceId, bundleName, and abilityName attributes for this Intent object. |
Intent |
setFlags(int flags) |
已过时。
This change is effective since API version 5.
Replaced by
OperationBuilder#withFlags(int) |
Intent |
setIntegerArrayListParam(String key,
ArrayList<Integer> value) |
Sets a parameter value of the
ArrayList type whose element type is Integer. |
void |
setOperation(Operation operation) |
Sets the description of an operation in an
Intent. |
Intent |
setParam(String key,
boolean value) |
Sets a parameter value of the boolean type.
|
Intent |
setParam(String key,
boolean[] value) |
Sets a parameter value of the boolean array type.
|
Intent |
setParam(String key,
byte value) |
Sets a parameter value of the byte type.
|
Intent |
setParam(String key,
byte[] value) |
Sets a parameter value of the byte array type.
|
Intent |
setParam(String key,
char value) |
Sets a parameter value of the char type.
|
Intent |
setParam(String key,
char[] value) |
Sets a parameter value of the char array type.
|
Intent |
setParam(String key,
double value) |
Sets a parameter value of the double type.
|
Intent |
setParam(String key,
double[] value) |
Sets a parameter value of the double array type.
|
Intent |
setParam(String key,
float value) |
Sets a parameter value of the float type.
|
Intent |
setParam(String key,
float[] value) |
Sets a parameter value of the float array type.
|
Intent |
setParam(String key,
int value) |
Sets a parameter value of the int type.
|
Intent |
setParam(String key,
int[] value) |
Sets a parameter value of the int array type.
|
Intent |
setParam(String key,
long value) |
Sets a parameter value of the long type.
|
Intent |
setParam(String key,
long[] value) |
Sets a parameter value of the long array type.
|
Intent |
setParam(String key,
short value) |
Sets a parameter value of the short type.
|
Intent |
setParam(String key,
short[] value) |
Sets a parameter value of the short array type.
|
Intent |
setParam(String key,
Serializable value) |
Sets a parameter value of the
Serializable type. |
Intent |
setParam(String key,
CharSequence value) |
Sets a parameter value of the CharSequence type.
|
Intent |
setParam(String key,
CharSequence[] value) |
Sets a parameter value of the CharSequence array type.
|
Intent |
setParam(String key,
String value) |
Sets a parameter value of the string type.
|
Intent |
setParam(String key,
String[] value) |
Sets a parameter value of the string array type.
|
Intent |
setParam(String key,
IntentParams parameter) |
Sets a parameter value of the
IntentParams type. |
Intent |
setParam(String key,
Sequenceable value) |
Sets a parameter value of the
Sequenceable type. |
Intent |
setParam(String key,
Sequenceable[] value) |
Sets a parameter value of the
Sequenceable array type. |
Intent |
setParams(IntentParams parameters) |
Sets an
IntentParams object in an Intent. |
<T extends Sequenceable> |
setParcelableArrayListParam(String key,
ArrayList<T> value) |
已过时。
This change is effective since API version 5.
Replaced by
setSequenceableArrayListParam(java.lang.String,java.util.ArrayList) |
void |
setPicker(Intent picker) |
Sets a picker
Intent for this Intent. |
<T extends Sequenceable> |
setSequenceableArrayListParam(String key,
ArrayList<T> value) |
Sets a parameter value of the
ArrayList type whose element type is Sequenceable. |
Intent |
setStringArrayListParam(String key,
ArrayList<String> value) |
Sets a parameter value of the
ArrayList type whose element type is String. |
Intent |
setType(String type) |
Sets the description of a type in this
Intent. |
Intent |
setUri(Uri uri) |
已过时。
This change is effective since API version 5. Replaced by
OperationBuilder#withUri(Uri). |
Intent |
setUriAndType(Uri uri,
String type) |
Sets the description of a uri and a type in this
Intent. |
String |
toUri() |
Converts parameter information in an
Intent into a URI string. |
boolean |
unmarshalling(Parcel in) |
Unmarshals an
Intent from a Parcel. |
hasFileDescriptorpublic static final String ACTION_BOOK_FLIGHT
public static final String ACTION_BOOK_HOTEL
public static final String ACTION_BOOK_TRAIN_TICKET
public static final String ACTION_BUNDLE_ADD
public static final String ACTION_BUNDLE_REMOVE
public static final String ACTION_BUNDLE_UPDATE
public static final String ACTION_BUY
public static final String ACTION_BUY_TAKEOUT
public static final String ACTION_HOME
public static final String ACTION_LOCALE_CHANGED
public static final String ACTION_ORDER_TAXI
public static final String ACTION_PLAN_ROUTE
public static final String ACTION_PLAY
public static final String ACTION_QUERY_ALMANC
public static final String ACTION_QUERY_CONSTELLATION_FORTUNE
public static final String ACTION_QUERY_ENCYCLOPEDIA
public static final String ACTION_QUERY_JOKE
public static final String ACTION_QUERY_LOGISTICS_INFO
public static final String ACTION_QUERY_NEWS
public static final String ACTION_QUERY_POI_INFO
public static final String ACTION_QUERY_RECIPE
public static final String ACTION_QUERY_SPORTS_INFO
public static final String ACTION_QUERY_STOCK_INFO
public static final String ACTION_QUERY_TRAFFIC_RESTRICTION
public static final String ACTION_QUERY_TRAVELLING_GUIDELINE
public static final String ACTION_QUERY_WEATHER
public static final String ACTION_SEND_LOGISTICS
public static final String ACTION_TRANSLATE_TEXT
public static final String ACTION_WATCH_VIDEO_CLIPS
public static final int CLONE_ACTION
action attribute will be copied.public static final int CLONE_BORDERS_RECT
BORDERS_RECT attribute will be copied.public static final int CLONE_BUNDLE
bundle attribute will be copied.public static final int CLONE_ELEMENT
element attribute will be copied.public static final int CLONE_ENTITIES
entities attribute will be copied.public static final int CLONE_PICKER
picker attribute will be copied.public static final int CLONE_URI
uri attribute will be copied.public static final String ENTITY_HOME
public static final String ENTITY_VIDEO
public static final int FLAG_ABILITYSLICE_FORWARD_RESULT
public static final int FLAG_ABILITYSLICE_MULTI_DEVICE
public static final int FLAG_ABILITY_CLEAR_MISSION
Intent passed to
Context.startAbility(ohos.aafwk.content.Intent, int) and must be used together with FLAG_ABILITY_NEW_MISSION.public static final int FLAG_ABILITY_CONTINUATION
public static final int FLAG_ABILITY_FORM_ENABLED
public static final int FLAG_ABILITY_FORWARD_RESULT
public static final int FLAG_ABILITY_MISSION_TOP
public static final int FLAG_ABILITY_NEW_MISSION
public static final int FLAG_INSTALL_ON_DEMAND
public static final int FLAG_INSTALL_WITH_BACKGROUND_MODE
public static final int FLAG_NOT_OHOS_COMPONENT
public static final int FLAG_START_FOREGROUND_ABILITY
public static final Sequenceable.Producer<Intent> PRODUCER
Intent instance from a Parcel.public Intent()
Intent instance.public Intent(Intent intent)
Intent instance by using the parameters of an existing
Intent object.intent - Indicates the existing Intent object.public Object clone()
Intent object.public void setOperation(Operation operation)
Intent.operation - Indicates the operation description.public Operation getOperation()
Intent.Intent.public Intent cloneOperation()
Intent object that contains only the operation component of this Intent.Intent object.public boolean operationEquals(Intent other)
Intent equals that of the specified
Intent object.other - Indicates the Intent object to compare.true if the operation components of the two objects are equal; returns
false otherwise.public int operationHashCode()
operation
attribute of this Intent object.public static Intent makeMainAbility(ElementName elementName)
Intent with its corresponding attributes specified for
starting the main ability of an application.
This method creates a standard Intent object where ACTION_HOME
is set as its action and the ENTITY_HOME entity is included by default.
elementName - Indicates the ElementName object defining the
deviceId, bundleName, and abilityName sub-attributes of the
operation attribute in an Intent.Intent object used to start the main ability of an application.public static Intent makeRestartAbilityMission(ElementName elementName)
Intent object and sets related flags for restarting a particular ability.
You can use this method to obtain a standard Intent object for starting an application.
This method has the similar effect as makeMainAbility(ohos.bundle.ElementName) but additionally sets flags
in the Intent to FLAG_ABILITY_NEW_MISSION and FLAG_ABILITY_CLEAR_MISSION.
elementName - Indicates the ElementName object containing the required attributes.Intent object used to restart a particular ability.public static Intent makeMainAbilityPicker(String pickerAction, String pickerEntity)
Intent with its picker Intent attributes specified for starting the main ability of an
application.
This method creates a standard Intent object where ACTION_HOME is set as its action and the
ENTITY_HOME entity is included by default.
pickerAction - Indicates the action attribute of the picker Intent.pickerEntity - Indicates the entity attribute of the picker Intent.Intent object used to start the main ability of an application.public boolean marshalling(Parcel out)
Intent into a Parcel.
Fields in the Intent are marshalled separately. If any field fails to be marshalled,
false is returned.
marshalling 在接口中 Sequenceableout - Indicates the Parcel object for marshalling.true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
Intent from a Parcel.
Fields in the Intent are unmarshalled separately. If any field fails to be unmarshalled,
false is returned.
unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object for unmarshalling.true if the unmarshalling is successful; returns false otherwise.public static Intent parseUri(String uri)
Intent instance by using a given Uniform Resource Identifier (URI).
This method parses the input URI and saves it in an Intent object.
uri - Indicates the URI to parse.Intent object containing the URI.public String toUri()
Intent into a URI string.public String getAction()
Intent.Intent.@Deprecated public Intent setAction(String action)
OperationBuilder#withAction(String).Intent.action - Indicates the action description.Intent object containing the action.@Deprecated public Intent setUri(Uri uri)
OperationBuilder#withUri(Uri).Intent.uri - Indicates the URI description.Intent object containing the URI.public Uri getUri()
Intent.Intent.public String getUriString()
Intent.@Deprecated public Intent addEntity(String entity)
OperationBuilder#withEntities(Set).Intent.entity - Indicates the entity description to add.Intent object containing the entity.public void removeEntity(String entity)
Intent.
If the number of entities is 0 after removal,the set will be set null.
entity - Indicates the entity description to remove.public boolean hasEntity(String entity)
Intent contains the given entity.entity - Indicates the entity to check.true if the given entity is contained; returns false otherwise.public Set<String> getEntities()
Intent.public int countEntities()
Intent.@Deprecated public Intent setFlags(int flags)
OperationBuilder#withFlags(int)Intent.
The module that receives or processes an Intent can use this method to set the value of
flags in the Intent.
flags - Indicates the flag to set.Intent object containing the flag.public Intent addFlags(int flags)
Intent.flags - Indicates the flag to add.Intent object with the added flag.public int getFlags()
Intent.public void removeFlags(int flags)
Intent.flags - Indicates the flag to remove.public ElementName getElement()
ElementName object in an Intent.ElementName description in the Intent.public Intent setElement(ElementName element)
ElementName object in an Intent.element - Indicates the ElementName description.Intent object containing the ElementName.public Intent setElementName(String bundleName, String abilityName)
bundleName and abilityName attributes for this Intent object.bundleName - Indicates the bundleName to set for the operation attribute in the
Intent.abilityName - Indicates the abilityName to set for the operation attribute in the
Intent.Intent object that contains the specified bundleName and
abilityName attributes.public Intent setElementName(String bundleName, Class<?> cls)
bundleName and abilityName attributes for this Intent.bundleName - Indicates the bundle name to be set as the value of the bundleName attribute.cls - Indicates the class name to be set as the value of the abilityName attribute.Intent object that contains the specified bundleName
and abilityName attributes.public Intent setElementName(String deviceId, String bundleName, String abilityName)
deviceId, bundleName, and abilityName attributes for this Intent object.deviceId - Indicates the deviceId to set for the operation attribute in the Intent.bundleName - Indicates the bundleName to set for the operation attribute in the
Intent.abilityName - Indicates the abilityName to set for the operation attribute in the
Intent.Intent object that contains the specified deviceId, bundleName,
and abilityName attributes.public Intent setElementName(String deviceId, String bundleName, Class<?> cls)
deviceId, bundleName, and abilityName attributes for this Intent.deviceId - Indicates the device ID to be set as the value of the deviceId attribute.bundleName - Indicates the bundle name to be set as the value of the bundleName attribute.cls - Indicates the class name to be set as the value of the abilityName attribute.Intent object that contains the specified deviceId, bundleName,
and abilityName attributes.public Intent setBundle(String bundleName)
Intent.
If a bundle name is specified in an Intent, the Intent will match only the abilities in
the specified bundle. You cannot use this method and setPicker(ohos.aafwk.content.Intent) on the same Intent.
bundleName - Indicates the bundleName name.Intent object containing the bundleName name.IllegalArgumentException - Throws this exception if bundleName is invalid.public String getBundle()
Intent.Intent.public Rect getBordersRect()
bordersRect attribute of this Intent.bordersRect attribute of this Intent.public void setBordersRect(Rect rect)
bordersRect attribute for this Intent.
The bordersRect attribute defines the borders (in screen coordinates)
of the ability that sends this Intent.rect - Indicates the Rect object to be set as the value of the bordersRect attribute.public String getScheme()
Intent.Intent.public Intent setType(String type)
Intent.
The type attribute in an Intent refers to the MIME type of the resource indicated by the URI
of the Intent.
type - Indicates the type description.Intent object containing the type.public String getType()
Intent.
The type attribute in an Intent refers to the MIME type of the resource indicated by the URI
of the Intent.
Intent.public Intent setUriAndType(Uri uri, String type)
Intent.uri - Indicates the URI description.type - Indicates the type description.Intent object containing the uri and the type.public Intent formatUri(Uri uri)
This method uses the Uri.getLowerCaseScheme() method to format a URI and then saves the
formatted URI to this Intent object.
uri - Indicates the URI to format.Intent object that contains the formatted uri attribute.public static String formatMimeType(String mimeType)
This method formats data of a specified MIME type by removing spaces from the data and converting the data
into lowercase letters. You can use this method to normalize the external data used to create Intent
information.
mimeType - Indicates the MIME type of the data to format.mimeType is specified; returns null otherwise.public Intent formatUriAndType(Uri uri, String type)
This method works in the same way as formatUri(ohos.utils.net.Uri) and formatType(java.lang.String).
uri - Indicates the URI to format.type - Indicates the MIME type to format.Intent object that contains the formatted uri and type attributes.public Intent formatType(String type)
This method uses the formatMimeType(java.lang.String) method to format a MIME type and then saves the formatted
type to this Intent object.
type - Indicates the MIME type to format.Intent object that contains the formatted type attribute.public void setPicker(Intent picker)
Intent for this Intent. This allows you to build a more generic Intent
to target desired applications more specifically.
If a picker Intent is set for an Intent, the attributes contained in the picker
Intent will be preferentially used for matching the desired application for handling the intent.
The picker Intent is used only for application matching without affecting the behavior of
equals(java.lang.Object) and hashCode().
This Intent itself cannot be set as its own picker Intent, and you cannot use this method
to set a picker while using setBundle(java.lang.String) on the same Intent.
picker - Indicates the Intent object to be set as a picker. This parameter can be null.IllegalArgumentException - Throws this exception if picker is invalid.public Intent getPicker()
Intent in this Intent.Intent object if any; returns null otherwise.public Intent setParams(IntentParams parameters)
IntentParams object in an Intent.parameters - Indicates the IntentParams description.Intent object containing the IntentParams.public IntentParams getParams()
IntentParams object in an Intent.IntentParams description in the Intent.public Intent setParam(String key, IntentParams parameter)
IntentParams type.key - Indicates the key matching the parameter.parameter - Indicates the IntentParams value of the parameter.Intent object containing the parameter value.public IntentParams getParam(String key)
IntentParams value matching the given key.key - Indicates the key of IntentParams.IntentParams value of the parameter matching the given key;
returns null if the key does not exist.IntentParams.getParam(String)public boolean hasParameter(String key)
Intent contains the parameter matching a given key.key - Indicates the key.true if the Intent contains the parameter; returns false otherwise.IntentParams.hasParam(String)public boolean getBooleanParam(String key, boolean defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default boolean value.IntentParams.getParam(String)public boolean[] getBooleanArrayParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public byte getByteParam(String key, byte defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default byte-type value.IntentParams.getParam(String)public byte[] getByteArrayParam(String key)
key - Indicates the key of IntentParams.null if the key does not exist.IntentParams.getParam(String)public short getShortParam(String key, short defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default short value.IntentParams.getParam(String)public short[] getShortArrayParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public char getCharParam(String key, char defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default char value.IntentParams.getParam(String)public char[] getCharArrayParam(String key)
key - Indicates the key of IntentParams.null if the key does not exist.IntentParams.getParam(String)public int getIntParam(String key, int defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default int value.IntentParams.getParam(String)public int[] getIntArrayParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public ArrayList<Integer> getIntegerArrayListParam(String key)
ArrayList parameter value of Integer elements that matches the given key.key - Indicates the key matching the parameter.ArrayList value of the parameter matching the given key; returns null if
the key does not exist.public long getLongParam(String key, long defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default long value.IntentParams.getParam(String)public long[] getLongArrayParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public float getFloatParam(String key, float defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default float value.IntentParams.getParam(String)public float[] getFloatArrayParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public double getDoubleParam(String key, double defaultValue)
key - Indicates the key of IntentParams.defaultValue - Indicates the default double value.IntentParams.getParam(String)public double[] getDoubleArrayParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public String getStringParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public String[] getStringArrayParam(String key)
key - Indicates the key of IntentParams.null
if the key does not exist.IntentParams.getParam(String)public ArrayList<String> getStringArrayListParam(String key)
ArrayList parameter value of String elements that matches the given key.key - Indicates the key matching the parameter.ArrayList value of the parameter matching the given key; returns null
if the key does not exist.public CharSequence getCharSequenceParam(String key)
key - Indicates the key of IntentParams.null if the key does not exist.IntentParams.getParam(String)public CharSequence[] getCharSequenceArrayParam(String key)
key - Indicates the key of IntentParams.null if the key does not exist.IntentParams.getParam(String)public ArrayList<CharSequence> getCharSequenceArrayListParam(String key)
ArrayList parameter value of CharSequence elements that matches the given key.key - Indicates the key matching the parameter.ArrayList value of the parameter matching the given key; returns null
if the key does not exist.public <T extends Serializable> T getSerializableParam(String key)
Serializable parameter value matching the given key.T - Indicates the subtype of Serializable.key - Indicates the key matching the parameter.Serializable value of the parameter matching the given key; returns null
if the key does not exist.@Deprecated public <T extends Sequenceable> T getParcelableParam(String key)
getSequenceableParam(java.lang.String)key - Indicates the key of IntentParams.IntentParams.getParam(String)public <T extends Sequenceable> T getSequenceableParam(String key)
key - Indicates the key of IntentParams.IntentParams.getParam(String)@Deprecated public Sequenceable[] getParcelableArrayParam(String key)
getSequenceableArrayParam(java.lang.String)Sequenceable array matching the given key.key - Indicates the key matching the parameter.Sequenceable array of the parameter matching the given key; returns null
if the key does not exist.IntentParams.getParam(String)public Sequenceable[] getSequenceableArrayParam(String key)
Sequenceable array matching the given key.key - Indicates the key matching the parameter.Sequenceable array of the parameter matching the given key; returns null
if the key does not exist.IntentParams.getParam(String)@Deprecated public <T extends Sequenceable> ArrayList<T> getParcelableArrayListParam(String key)
getSequenceableArrayListParam(java.lang.String)ArrayList parameter value of Sequenceable elements that matches the given key.T - Indicates the subtype of Sequenceable.key - Indicates the key matching the parameter.ArrayList value of the parameter matching the given key; returns null
if the key does not exist.public <T extends Sequenceable> ArrayList<T> getSequenceableArrayListParam(String key)
ArrayList parameter value of Sequenceable elements that matches the given key.T - Indicates the subtype of Sequenceable.key - Indicates the key matching the parameter.ArrayList value of the parameter matching the given key; returns null
if the key does not exist.public Intent setParam(String key, boolean value)
key - Indicates the key matching the parameter.value - Indicates the boolean value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, boolean[] value)
key - Indicates the key matching the parameter.value - Indicates the boolean array of the parameter.Intent object containing the parameter value.public Intent setParam(String key, byte value)
key - Indicates the key matching the parameter.value - Indicates the byte-type value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, byte[] value)
key - Indicates the key matching the parameter.value - Indicates the byte array of the parameter.Intent object containing the parameter value.public Intent setParam(String key, char value)
key - Indicates the key matching the parameter.value - Indicates the char value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, char[] value)
key - Indicates the key matching the parameter.value - Indicates the char array of the parameter.Intent object containing the parameter value.public Intent setParam(String key, short value)
key - Indicates the key matching the parameter.value - Indicates the short value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, short[] value)
key - Indicates the key matching the parameter.value - Indicates the short array of the parameter.Intent object containing the parameter value.public Intent setParam(String key, int value)
key - Indicates the key matching the parameter.value - Indicates the int value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, int[] value)
key - Indicates the key matching the parameter.value - Indicates the int array of the parameter.Intent object containing the parameter value.public Intent setIntegerArrayListParam(String key, ArrayList<Integer> value)
ArrayList type whose element type is Integer.key - Indicates the key matching the parameter.value - Indicates the parameter value.Intent object containing the parameter value.public Intent setParam(String key, long value)
key - Indicates the key matching the parameter.value - Indicates the long value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, long[] value)
key - Indicates the key matching the parameter.value - Indicates the long array of the parameter.Intent object containing the parameter value.public Intent setParam(String key, float value)
key - Indicates the key matching the parameter.value - Indicates the float value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, float[] value)
key - Indicates the key matching the parameter.value - Indicates the float array of the parameter.Intent object containing the parameter value.public Intent setParam(String key, double value)
key - Indicates the key matching the parameter.value - Indicates the double value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, double[] value)
key - Indicates the key matching the parameter.value - Indicates the double array of the parameter.Intent object containing the parameter value.public Intent setParam(String key, String value)
key - Indicates the key matching the parameter.value - Indicates the string value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, String[] value)
key - Indicates the key matching the parameter.value - Indicates the string array of the parameter.Intent object containing the parameter value.public Intent setStringArrayListParam(String key, ArrayList<String> value)
ArrayList type whose element type is String.key - Indicates the key matching the parameter.value - Indicates the parameter value.Intent object containing the parameter value.public Intent setParam(String key, CharSequence value)
key - Indicates the key matching the parameter.value - Indicates the CharSequence value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, CharSequence[] value)
key - Indicates the key matching the parameter.value - Indicates the CharSequence array of the parameter.Intent object containing the parameter value.public Intent setCharSequenceArrayListParam(String key, ArrayList<CharSequence> value)
ArrayList type whose element type is CharSequence.key - Indicates the key matching the parameter.value - Indicates the parameter value.Intent object containing the parameter value.public Intent setParam(String key, Serializable value)
Serializable type.key - Indicates the key matching the parameter.value - Indicates the Serializable value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, Sequenceable value)
Sequenceable type.
You should first call IntentParams#setClassLoader(ClassLoader) to set a ClassLoader for
such type of parameters before calling this method.
key - Indicates the key matching the parameter.value - Indicates the Sequenceable value of the parameter.Intent object containing the parameter value.public Intent setParam(String key, Sequenceable[] value)
Sequenceable array type.
You should first call IntentParams#setClassLoader(ClassLoader) to set a ClassLoader for
such type of parameters before calling this method.
key - Indicates the key matching the parameter.value - Indicates the parameter value.Intent object containing the parameter value.@Deprecated public <T extends Sequenceable> Intent setParcelableArrayListParam(String key, ArrayList<T> value)
setSequenceableArrayListParam(java.lang.String,java.util.ArrayList)ArrayList type whose element type is Sequenceable.
You should first call IntentParams#setClassLoader(ClassLoader) to set a ClassLoader for
such type of parameters before calling this method.
T - Indicates the subtype of Sequenceable.key - Indicates the key matching the parameter.value - Indicates the parameter value.Intent object containing the parameter value.public <T extends Sequenceable> Intent setSequenceableArrayListParam(String key, ArrayList<T> value)
ArrayList type whose element type is Sequenceable.
You should first call IntentParams#setClassLoader(ClassLoader) to set a ClassLoader for
such type of parameters before calling this method.
T - Indicates the subtype of Sequenceable.key - Indicates the key matching the parameter.value - Indicates the parameter value.Intent object containing the parameter value.public void removeParam(String key)
key - Indicates the key matching the parameter to be removed.public Intent replaceParams(IntentParams intentParams)
Intent object with those in the given IntentParams object.intentParams - Indicates the IntentParams object containing the new parameters.Intent object containing the new parameters.public Intent replaceParams(Intent intent)
Intent object with those in the given Intent object.intent - Indicates the Intent object containing the new parameters.Intent object containing the new parameters.public int cloneByIntent(Intent other, int flags)
Intent.other - Indicates the Intent object whose attributes are to be copied.flags - Indicates the attributes to be copied, which can be any combination of CLONE_ACTION,
CLONE_URI, CLONE_ENTITIES, CLONE_BUNDLE, CLONE_PICKER,
CLONE_ELEMENT, and CLONE_BORDERS_RECT.public static Intent createSelectIntent(Intent target, CharSequence title)
Intent instance that is intended to open an application selection dialog box based on the
specified Intent object.target - Indicates the Intent object that specifies the candidate applications for selection.title - Indicates the title of the application selection dialog box.Intent object.public boolean equals(Object other)
Object
The equals method implements an equivalence relation
on non-null object references:
x, x.equals(x) should return
true.
x and y, x.equals(y)
should return true if and only if
y.equals(x) returns true.
x, y, and z, if
x.equals(y) returns true and
y.equals(z) returns true, then
x.equals(z) should return true.
x and y, multiple invocations of
x.equals(y) consistently return true
or consistently return false, provided no
information used in equals comparisons on the
objects is modified.
x,
x.equals(null) should return false.
The equals method for class Object implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x and
y, this method returns true if and only
if x and y refer to the same object
(x == y has the value true).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode method, which states
that equal objects must have equal hash codes.
equals 在类中 Objectother - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
HashMappublic int hashCode()
ObjectHashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)