2

我们知道我们可以使用以下命令行字符串调用活动,

adb shell am
usage: am [start|instrument]
       am start [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
                [-c <CATEGORY> [-c <CATEGORY>] ...]
                [-e <EXTRA_KEY> <EXTRA_VALUE> [-e <EXTRA_KEY> <EXTRA_VALUE> ...]
                [-n <COMPONENT>] [-D] [<URI>]

我想知道的是如何设置数据 uri 和类别的字段,例如,如果活动类具有这样的意图过滤器,

<intent-filter android:label="@string/resolve_edit">
    <action android:name="android.intent.action.VIEW" />
    <action android:name="android.intent.action.EDIT" />
    <action android:name="com.android.notepad.action.EDIT_NOTE" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="vnd.android.cursor.item/vnd.google.note" />
</intent-filter>

如何使用数据 uri 和类别名称以及 mimetype 作为参数调用活动?只需给我一个示例命令行字符串,让我们假设活动是com.test.test1/.Main

谢谢。

4

1 回答 1

0

您已经尝试过哪种命令?

这是否可行:

adb shell am start -a android.intent.action.VIEW -c android.intent.category.DEFAULT -t vnd.android.cursor.item/vnd.google.note -n com.test.test1/.Main -d " file:///storage/removable/sdcard1/testFile.txt"

于 2013-11-04T04:23:31.800 回答