Ok, that will be great!

thanks!

On Fri, May 28, 2010 at 5:06 PM, Brad Gies <rbg...@gmail.com> wrote:

> Jose,
>
> I'm working on the same thing right now. I believe the answer is below :).
>
> public class EditPreferences extends PreferenceActivity
> {
>    Preference.OnPreferenceChangeListener listListener = new
> Preference.OnPreferenceChangeListener()
>    {
>
>        @Override
>        public boolean onPreferenceChange(Preference preference, Object
> newValue)
>        {
>
>            return true;
>        }
>    };
>
>
> I will be doing some work on this today, and will let you know if/when I
> find the complete answer ).
>
>
>
>
>
> On 28/05/2010 6:05 AM, Jose Luis Montes wrote:
>
>> Hello!
>>
>> I want to put a ListPreference in my preference screen. But all the
>> examples I have found in Internet the content are loaded out of a xml and I
>> need that de options in the ListPreference are dynamic and not previously
>> defined (in a xml).
>>
>> I have mi preferences.xml in the folder xml/ of my project;
>>
>> this is the code of preferences.xml:
>>
>>    <?xml version="1.0" encoding="utf-8"?>
>>
>>    <PreferenceScreen
>>    xmlns:android="http://schemas.android.com/apk/res/android";>
>>
>>    <CheckBoxPreference
>>
>>              android:key="gcalendar_integration"
>>
>>              android:title="@string/gcalendar_integration"
>>
>>              android:summary="@string/gcalendar_integration_summary"
>>
>>              android:defaultValue="false"
>>              android:persistent="true" />
>>
>>
>>    <ListPreference
>>
>>              android:key="gcalendar_list"
>>
>>              android:title="lista"
>>
>>              android:summary="descripcion lista"
>>
>>              android:persistent="true"
>>
>>              android:dependency="gcalendar_integration" />
>>
>>    </PreferenceScreen>
>>
>>
>>
>>
>> and the PreferenceActivity which calls the xml: (i have omitted  the
>> imports)
>>
>>    public class Preferences extends PreferenceActivity {
>>
>>
>>        @Override
>>
>>        public void onCreate(Bundle savedInstanceState) {
>>
>>    super.onCreate(savedInstanceState);
>>
>>    addPreferencesFromResource(R.xml.preferences);
>>
>>        }
>>    }
>>
>> But I dont have a clue about how to set the contents of the ListPreference
>> dynamically at the code. I have seen that the class ListPreference has a
>> method .setEntries(CharSequence[] list) which is for this purposes but I
>> don't know how to link an object of the ListPreference at the code with the
>> ListPreference defined at the xml.
>>
>> Any idea?
>>
>> Thanks in advance!
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
> --
> Sincerely,
>
> Brad Gies
> -----------------------------------------------------------------------
> Bistro Bot - Bistro Blurb
> http://www.bgies.com
> http://www.bistroblurb.com
> http://www.bistrobot.com
> -----------------------------------------------------------------------
>
> Never doubt that a small group of thoughtful, committed people can
> change the world. Indeed. It is the only thing that ever has - Margaret
> Mead
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to