I am trying to fill up my ListPreference from within my Activity rather than have the array stored in xml. However I am finding this problematic. I may be setting up my preferences wrong. I have access to my ListPreference however filling the content dynamically I can’t seem to get. I have looked at this post. Is it possible to load ListPreference items from an adapter? but I can’t seem to figure it out from this.
I am trying to occupy the ListPreference with Strings from a List of objects.
This is what I have so far:
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
SharedPreferences settings = getSharedPreferences(LUAS_TIMES_PREF, 0);
ListPreference lp = (ListPreference)findPreference("station_pref");
}
Not much but how can I fill this list preference with my own list?
Thanks in advance.
It should be as simple as:
Extrapolate as required 🙂