android - Intent 过滤器浏览器 android :pathPrefix url parameter

标签 android url parameters android-intent intentfilter

所以我希望在 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/

相关文章:

javascript - AngularJS - 将配置参数传递给指令

android - 想打开 whatsapp 与 android 应用程序中未保存的联系电话聊天

java - 在模块 graphview 中发现重复的类

java.lang.ClassCastException 接口(interface)在 android java 上

javascript - 在 JavaScript 中重定向 : IF GET parameter key allow to stay on the page; otherwise redirect to another page

带有 IN 子句和参数的 MySQL 错误输出

android - 通过 Python 从 Android 访问 LogCat

ruby-on-rails - Rails : how to get the current host, 或用它构建 URL?

html - 强制在 Jekyll 中使用绝对 URL

parameters - Doxygen:复制单个参数的描述