Android Intent Butchers 数据

Android Intent Butchers Data

我有一个正在使用的 PreferenceScreen,我添加了一个 Preference,它充当可点击的 link。

我有以下代码:

<Preference android:title="@null" android:height="10px" android:paddingTop="0px" android:summary="Learn More" android:key="mypref">
    <intent 
        android:action="android.intent.action.View"
        android:mimeType="text/html"
        android:data="http://www.google.com"/>
</Preference>

当我点击这个首选项时,

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.View dat=http: typ=text/html }

我试过转义字符,但行为更糟(只有 "www.google.com" 给出空数据)。

这是调用 action.VIEW 的正确方法(注意大写单词)

此外,删除 mimeType

<Preference android:title="@null" android:height="10px" android:paddingTop="0px" android:summary="Learn More" android:key="mypref">
<intent 
    android:action="android.intent.action.VIEW"
    android:data="http://www.google.com"/>
</Preference>