打开链接时打开活动

时间:2016-11-18 08:36:12

标签: android

当用户点击我网页上的链接,指向itr文件时,我想打开我的活动,目前我已经拥有:

 <activity
    android:name=".ui.Activity"
    android:label="@string/activity_load"
    android:theme="@android:style/Theme.Translucent.NoTitleBar">
    <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:host="www.mywebsite.com" android:pathPattern="*.itr"/>
    </intent-filter>
</activity>

网页在此页面的http://www.mywebsite.com/contents上打开,用户可以点击指向itr文件的链接。但是我的活动没有打开,有什么提示吗?

1 个答案:

答案 0 :(得分:2)

只需从intent-filter中的data节点中删除pathPattern即可。 路径模式限制uri遵循应用的标准check here