Android的意图过滤器的数据路径preFIX时不存在于URL渔获 [英] android intent-filter data pathprefix catches when not exists in the url

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

问题描述

我要赶上我的网站的网址在我的网站上的观点和行动的具体路径。

I want to catch the view action of my site url and an specific path in my site.

http://examplesite.com/
http://examplesite.com/detail/nameOfProduct

我想主要活动是开放的,所以我用的第一个网址:

I want the main activity to be open for the first url so I used:

<data
   android:host="examplesite.com"
   android:scheme="http"/>

和第二URL我希望要打开的详细活动,所以我把:

and for the second url I want the detail activity to be opened so i put:

<data
   android:host="examplesite.com"
   android:pathPrefix="/detail"
   android:scheme="http"/>

现在的问题是,当第一个URL被称为意图两个行为都被证明是用户选择,而我只是想显示的主要活动。我怎样才能解决这个问题。我做了什么错?

now the problem is when the first URL is called in an intent both activities are shown to user to choose, while I just want the main activity to be shown. how can I solve this problem. what did I do wrong ?

推荐答案

我建议你只注册主要活动和分析存在的网址,如果它导致/细节,推出详细的活动

I recommend you to register only main activity and parse there the url, if it leads to /detail, launch detail activity

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

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