I already have a preference screen that uses preferences from xml but I would like to create a Preference that opens a webpage url using an intent. However, the url comes from another preference.
So I'm wondering if there is a way to programmatically create this preference so I can inject this url on creation of the preference screen.
What I've tried so far is this post but that's only for a checkbox preference. I wanted to make a preference that would normally have an intent with android:action
and android:data
in its xml. For example:
<Preference android:title="@string/prefs_web_page">
<intent android:action="android.intent.action.VIEW"
android:data="http://192.168.1.104" />
</Preference>
How can I do this programmatically? Thank you!