From my PreferenceScreen I want to open links in WebView not browser. Any ideas?
Here is part of my xml:
<PreferenceCategory
android:title="@string/about">
<PreferenceScreen
android:title="@string/eula"
android:summary="">
<intent android:action="android.intent.action.VIEW"
android:data="http://www.tara.com/m/EULA.aspx" />
</PreferenceScreen>
<PreferenceScreen
android:title="@string/privacy_policy"
android:summary="">
<intent android:action="android.intent.action.VIEW"
android:data="http://www.tara.com/m/Legal/Privacy.aspx" />
</PreferenceScreen>
<PreferenceScreen
android:title="@string/version"
android:summary="@string/version_name">
</PreferenceScreen>
<PreferenceScreen
android:title="@string/customer_support"
android:summary="@string/email_description">
<intent android:action="com.tara.android.turboweather.EMAIL_ACCUWX"
/>
</PreferenceScreen>
<PreferenceScreen
android:title="@string/branding"
android:summary="">
</PreferenceScreen>
</PreferenceCategory>
So where the URLs are I want to open an Android WebView, not open the phone's browser.
You should the use a click listener on your preference item and when it s clicked, open your activity.
in XMl, replace the PreferenceScreen by a Preference and give it a key
<Preference android:title="About"
android:summary="Details about the app"
android:key="aboutPref" />
then in your preference activity, after loading the preference file :
Preference pref = findPreference( "aboutPref" );
pref.setOnPreferenceClickListener( myListener );
where myListener is an instance of an inner class that will launch your activity and pass the url to open in intent extra data.
Regards, Stéphane
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With