意图过滤器的android:路径preFIX URL参数 [英] Intent filter browser android:pathPrefix url parameter

查看:378
本文介绍了意图过滤器的android:路径preFIX URL参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想我的活动赶上当一个意图(浏览器)调用链接:

So I'd like my activity to catch when an intent (browser) calls the link:

http://host/info?username=samplename 

而不是当:

http://host/info?username=noname 

下面是我的code从AndroidManifest.xml中来。

Here is my code coming from 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>

我有工作了简单的preFIX如Android:路径preFIX =/信息
但我与人品问题?
我试着使用\\?但不工作
http://developer.android.com/guide/topics/manifest /data-element.html#path

有人会知道吗?

感谢

推荐答案

你试过\\\\?

由于'\\'作为当字符串从XML读取(之前它被解析为一个模式)转义字符,则需要仔细逃生:例如,文字'的将写为\\ 的与字面'\\'会被写成\\\\。这基本上是一样的,你需要建造是否在Java中code中的字符串写什么。

Because '\' is used as an escape character when the string is read from XML (before it is parsed as a pattern), you will need to double-escape: For example, a literal '' would be written as "\" and a literal '\' would be written as "\\". This is basically the same as what you would need to write if constructing the string in Java code.

这篇关于意图过滤器的android:路径preFIX URL参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆