"intent-filter"中的android过滤器网址 [英] android filter url in "intent-filter"

查看:130
本文介绍了"intent-filter"中的android过滤器网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个用于下载图像的应用程序.当用户单击下载图像链接时,我已经成功触发了我的应用程序.如何过滤特定的URL?

I'm developing a application for download image. I have successful to trigger my app when the user click the download image link.How do i filter the specific URL?

这是我的清单代码:

<activity android:theme="@style/Transparent" android:name=".DownloadImage"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:mimeType="image/*" android:host="*"
                android:scheme="http" />
        </intent-filter>
</activity>

当用户单击浏览器中的任何链接但未触发特定URL(例如"http://www.ABC.com"或特定项目"http://www.ABC")时,我的应用程序将启动并下载图像. .com/image/background.jpg"

my application will launch and download the image when user click any link in browser but not trigger on specific url, for example "http://www.ABC.com" or the specific item "http://www.ABC.com/image/background.jpg"

推荐答案

当您的应用程序要求下载图像时,您应该浏览以下链接:

when your application called for download image you should explore link:

    Intent intent = getIntent();
    String link = intent.getDataString();

这篇关于"intent-filter"中的android过滤器网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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