Kamis, 09 Mei 2013

Open page in PreferenceFragment with intent

Add Preference of <intent> with android:action="android.intent.action.VIEW" and android:data="http://...", user can click the item to open browser to visit the specified web address.

Example:

PreferenceFragment with intent
PreferenceFragment with intent


<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

<PreferenceCategory
android:title="PreferenceCategory CheckBoxPreference">
<CheckBoxPreference
android:key="PREF_CHECKBOX"
android:title="Title"
android:summary="summary" />
</PreferenceCategory>

<PreferenceCategory
android:title="PreferenceCategory ListPreference">
<ListPreference
android:key="PREF_LIST"
android:title="ListPreference title"
android:summary="ListPreference summary"
android:entries="@array/listentries"
android:entryValues="@array/listvalues" />
</PreferenceCategory>

<PreferenceCategory
android:title="PreferenceCategory Intent">
<PreferenceScreen
android:title="Android Coding"
android:summary="android-coding.blogspot.com">
<intent android:action="android.intent.action.VIEW"
android:data="http://android-coding.blogspot.com/" />
</PreferenceScreen>
<PreferenceScreen
android:title="Android Developers"
android:summary="developer.android.com">
<intent android:action="android.intent.action.VIEW"
android:data="http://developer.android.com/" />
</PreferenceScreen>
<PreferenceScreen
android:title="Google"
android:summary="www.google.com">
<intent android:action="android.intent.action.VIEW"
android:data="http://www.google.com/" />
</PreferenceScreen>
</PreferenceCategory>

</PreferenceScreen>


0 komentar:

Posting Komentar

Copyright © 2012 Codding News All Right Reserved