Is it possible to load ListPreference items from an adapter?

Posted by Brad Hein on Stack Overflow See other posts from Stack Overflow or by Brad Hein
Published on 2010-05-29T23:15:46Z Indexed on 2010/05/29 23:22 UTC
Read the original article Hit count: 443

Filed under:
|
|
|

I'm setting out to create a settings activity for my app. I've defined a PreferenceActivity with a nice layout including a ListPreference object for the user to select a bluetooth device. I'm having trouble dynamically populating the list.

I would like to populate ListPreference with values from an array adapter (which I'll create and populate with relevant bluetooth device names).

If this were a spinner View, I could just call setAdapter(). However with the ListPreference object I can't figure out how to attach an adapter (findviewByID won't cast from View To ListPreference, so I can't even get a handle to the object).

I would like to attach an adapter and then populate the adapter with values, which in turn would populate the ListPreference with values.

© Stack Overflow or respective owner

Related posts about android

Related posts about array