Pro Android with Kotlin



Yüklə 4,6 Kb.
Pdf görüntüsü
səhifə33/231
tarix29.11.2023
ölçüsü4,6 Kb.
#138831
1   ...   29   30   31   32   33   34   35   36   ...   231
@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.



Yüklə 4,6 Kb.

Dostları ilə paylaş:
1   ...   29   30   31   32   33   34   35   36   ...   231




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə