Phillip Huff
Phillip Huff

Reputation: 565

Android Intent Butchers Data

I have a PreferenceScreen I'm working on and I've added a Preference which acts as a clickable link.

I have the following code:

<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>

When I click this preference,

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

I've tried escaping characters, but the behavior is even worse (only "www.google.com" gives an empty dat).

Upvotes: 2

Views: 57

Answers (1)

user3077828
user3077828

Reputation:

This is the correct way to call action.VIEW (notice uppercase word)

Also, remove 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>

Upvotes: 1

Related Questions