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>
  • 相关阅读:
    [LINUX-05]Linux的进程线程及调度
    如何感性地理解EM算法?
    [LINUX-04]linux进程、调度、线程、进程上下文等几点理解
    centos定时删除log文件
    关于 Nginx 配置的一些疑惑, Nginx 根据cookie 进行rewrite
    oracle中如何创建表的自增ID(通过序列)
    Windows下PHP7/5.6以上版本 如何连接Oracle 12c,并使用PDO
    Tomcat不能访问ln -s软连接文件夹的前因后果
    rm命令删除文件时排除特定文件
    nginx中的url转发
  • 原文地址:https://www.cnblogs.com/android-zcq/p/5882012.html
Copyright © 2011-2022 走看看