9 android intentfilter android-activity
我正在尝试设置一个intent过滤器,以便在用户单击以下URI时启动我的活动:example.com/pathA/pathB/#pathC/someGUID
所以我将以下XML添加到清单文件中:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="example.com"
android:pathPrefix="/pathA/pathB/#pathC"
android:scheme="http" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
我认为'#'char正在搞乱,但我试图逃避这个char而没有运气.有任何想法吗?
更新:当我说"尝试转义"时我的意思是使用百分比编码(#equals%23)
ian*_*ake 14
Intent过滤器使用UriMatcher来解析URI并确定是否存在匹配.#是一个数字的URI通配符,如UriMatcher中的示例所示.根据UriMatcher源代码,没有转义序列来转义#URI中的a.因此,您应该使用另一个非保留符号(注意,*它也保留为任何文本的通配符).
| 归档时间: |
|
| 查看次数: |
2240 次 |
| 最近记录: |