【问题标题】:calling an activity from command line with category and data uri从命令行使用类别和数据 uri 调用活动
【发布时间】:2013-08-22 03:24:52
【问题描述】:

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

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

谢谢。

【问题讨论】:

    标签: android android-intent android-activity intentfilter


    【解决方案1】:

    您已经尝试过哪种命令?

    这能解决吗:

    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"

    【讨论】:

      猜你喜欢
      • 2014-01-28
      • 2019-12-20
      • 1970-01-01
      • 2015-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 1970-01-01
      相关资源
      最近更新 更多