[Android] configuration of implicit intention

The manifest file in ndroid is equivalent to the registry on windows. For example, the player can open the associated file directly, and the intent filter node of the activity node in the manifest file can be configured

Add the < action / > action node and set the name Android: name = "com. XXX. XX. XX"

Add the < category / > Default additional option node and set the name Android: name = "Android. Intent. Action. Default"

Add < data / > data nodes,

Set the protocol specification Android: scheme = "HTTP"

Set the host name Android: host = "www.baidu. Com"

Set data type Android: mimeType = "vnd. Android. Cursor. Item / haha"

Test the configuration of this implicit intent

Get the intent object and get it through new

Call setaction (action) method of intent object, parameter: String object, for example: "com. XXX. XX. XX"

Call the addcategory (category) method of the intent object to set the preconditions. Parameters: corresponding to the above configuration

Call the SetData (URI) method of the intent object to set the data. Parameters: URI object uri.parse(“ http://xxx ”)

Call the settype() method of the intent object to set the data type. Parameters: corresponding to the above configuration, this method and setdata() cannot coexist

To solve this problem, call the setdataandtype (data, type) method of the intent object, hehe

Call startactivity()

Get data in the second activity after jump

Get the intent object and call the getintent () method

Call the GetData () method of the intent object to get the URI object

Call the toString () method of URI object and print it out

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>