Pro Android with Kotlin


Download 5.42 Mb.
Pdf ko'rish
bet33/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   29   30   31   32   33   34   35   36   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile

20
CHAPTER 3: Activities
When an intent is used on the invoker side, you can add categories by writing the following, 
for example:
val intent:Intent = Intent(...)
intent.addCategory("android.intent.category.ALTERNATIVE")
Standard categories correspond to constants with names like CATEGORY_* inside the 
android.content.Intent class. You can find them listed in the section “Intent Constituent 
Parts” in the online text companion.
Caution For implicit intents, you must use the DEFAULT category inside the filter. This is 
because the methods startActivity() and startActivityForResult() use this category 
by default.
Intent Data
The  child of the filter is a data type specification for the filter. The syntax is as follows:
android:host="string"
android:port="string"
android:path="string"
android:pathPattern="string"
android:pathPrefix="string"
android:mimeType="string" />
You can specify either of the following or both of the following:

A data type specified by only the mimeType element, for example, text/
plain or text/html. So, you can write the following:


A data type specified by scheme, host, port, and some path 
specification: ://:
[
|
|
Pattern>]. Here 
 means the full path
 is the start 
of a path, and 
 is like a path but with wildcards: X* is 
zero or more occurrences of the character X, and .* is zero or more 
occurrences of any character. Because of escaping rules, write \\* for an 
asterisk and \\\\ for a backslash.
On the caller side, you can use setType(), setData(), and setDataAndType() to set any data 
type combination.



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   29   30   31   32   33   34   35   36   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling