zoukankan      html  css  js  c++  java
  • android.intent.category.BROWSABLE

    参考:

    http://blog.csdn.net/annkie/article/details/8349626

    http://xiechengfa.iteye.com/blog/1004991

    BROWSABLE的意思就是浏览器在特定条件下可以打开你的activity:

    举例1:
    我有一个activity,它注册了能显示pdf文档,AndroidManifest.xml内容如下:
                

    <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:scheme="http"
           android:mimeType="application/pdf"/>
    </intent-filter>

    你在浏览器中输入  http://www.devdiv.com/1.pdf ,那么这个activity自动被浏览器给调起来。

    类似我们注册了一个数据类型,指定默认打开这个数据类型的应用程序

    举例2: 开源中国的 

    <activity
                android:name=".ui.MainActivity"
                android:launchMode="singleTask"
                android:screenOrientation="portrait">
                <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data
                        android:host="www.oschina.net"
                        android:scheme="http" />
                </intent-filter>
                <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data
                        android:host="www.oschina.net"
                        android:scheme="https" />
                </intent-filter>
                <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data
                        android:host="my.oschina.net"
                        android:scheme="http" />
                </intent-filter>
                <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.BROWSABLE" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data
                        android:host="my.oschina.net"
                        android:scheme="https" />
                </intent-filter>
            </activity>
  • 相关阅读:
    Luogu 3119 [USACO15JAN]草鉴定Grass Cownoisseur
    Luogu 4514 上帝造题的七分钟
    Luogu 1484 种树
    Luogu【P2904】跨河(DP)
    Luogu【P2065】贪心的果农(DP)
    Luogu【P1725】琪露诺(单调队列,DP)
    二分图匹配
    单调队列
    Tarjan的强联通分量
    手写堆
  • 原文地址:https://www.cnblogs.com/android-zcq/p/5882012.html
Copyright © 2011-2022 走看看