android Intent 过滤器模式匹配

标签 android android-intent

我的 Intent 过滤器看起来像这样:

        <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:scheme="*" 
                  android:host="*" 
                  android:pathPattern="/pickup.jsp\?h=.+&p=.*&l=-?[0-9]+" />
        </intent-filter>

我在 eclipse 中遇到解析器错误:

[com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] 
Parser exception for C:\projects\myapp\AndroidManifest.xml: 
The reference to entity "p" must end with the ';' delimiter.

我正在尝试使用正则表达式为任何方案和任何主机匹配 URL /path/pickup.jsp?h=handle&p=&l=4234。那可能吗?如果是这样,我将如何匹配它?

最佳答案

I'm trying to match the URL /path/pickup.jsp?h=handle&p=&l=4234

那是不可能的。查询参数不是 Uri 的一部分来自 <intent-filter>立场,因此无法匹配。

关于android Intent 过滤器模式匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15301117/

相关文章:

java - 如何根据设备制造商执行不同的代码?

Java - 转发对象

java - 如何在android中暂停和恢复倒计时器

android - 将 MySQL 工作台连接到 Eclipse

java - fragment java.lang.ClassCastException错误

java - Android无法获取Texview内容分享 Intent

java - Android:无法实例化服务 Java.NullPointerException

android - 如何将主题应用于 <PreferenceCategory> 的 <PreferenceScreen> 元素

java - 模拟器尝试使用句柄0 android studio删除不存在的颜色缓冲区

android - startActivityForResult() 和 startActivity() 的区别?