Hi,
Using below code we add 6the elements to the spinner dynamically
userDisplaySpinner = (Spinner) findViewById(R.id.*SpinnerInAddUsers*);
ArrayAdapter<String> adapter2 = *new* ArrayAdapter<String>(*this*
,android.R.layout.*simple_spinner_item*, array);
adapter2.setDropDownViewResource(android.R.layout.*
simple_spinner_dropdown_item*);
userDisplaySpinner.setAdapter(adapter2);
in the Abov ecode "array" takes the elements dynamically which are
dispalyed in spinner like
array[]="A,B,C,D"
On 5/12/10, Lars Nielsen Lind <[email protected]> wrote:
>
> Hi,
>
> we have an XML file placed in the res/xml folder containing our
> preferences.
>
> Is it possible at runtime to add new items to the preferences.
>
> Example:
>
> The user starts the app and the preferences consists of:
>
> America
>
> - New York
> - Los Angeles
> - Chicago
>
> Where all the cities are CheckBoxPreferences.
>
> Then the user performs some actions in the application and this triggers
> that two new cities are added to the preferences:
>
> America
>
> - New York
> - Los Angeles
> - Chicago
> - Seatlle
> - Washington
>
>
> Anyone that know if it possible at all and how to do it?
>
> thanks,
>
> Lars
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
Praveena Ankitha
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en