Android的回应网址意向 [英] Android Respond To URL in Intent

查看:171
本文介绍了Android的回应网址意向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的意图来启动,当用户进入一个特定的URL:例如,在Android市场上的确有这个 HTTP://市场.android.com / 网址。这样做的YouTube。我想我的这样做了。

I want my intent to be launched when the user goes to a certain url: for example, the android market does this with http://market.android.com/ urls. so does youtube. I want mine to do that too.

推荐答案

我做到了!使用<一个href="https://developer.android.com/guide/topics/manifest/intent-filter-element.html"><$c$c><intent-filter>.把下面的内容清单文件:

I did it! Using <intent-filter>. Put the following into your manifest file:

<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="www.youtube.com" android:scheme="http"></data>
</intent-filter>

这完美的作品!

这篇关于Android的回应网址意向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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