所以我希望在 Intent (浏览器)调用链接时捕捉到我的 Activity :
http://host/info?username=samplename
而不是什么时候:
http://host/info?username=noname
这是我的代码来自 AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>\
<data android:host="host" android:pathPrefix="/info?username=samplename" android:scheme="http"></data>
</intent-filter>
我让它为一个简单的前缀工作,比如 android:pathPrefix="/info" 但是我的性格有问题? 我尝试使用\?但不起作用 http://developer.android.com/guide/topics/manifest/data-element.html#path
有人知道吗?
谢谢
最佳答案
你试过\\吗?
因为当从 XML 中读取字符串时(在将其解析为模式之前),'\' 用作转义字符,因此您需要进行两次转义:例如,文字 '' 将是写为“\”,文字“\”将写为“\\”。这与在 Java 代码中构造字符串时需要编写的内容基本相同。
关于android - Intent 过滤器浏览器 android :pathPrefix url parameter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8090441/