Lists.asList(String[]) creates a read-only List :(
On Thu, Sep 25, 2008 at 4:14 AM, AndreAgosto <[EMAIL PROTECTED]> wrote:
>
> hi, why this code doesn't work?
>
> String[] cols = getResources().getStringArray(R.array.colors);
> List<String> colsAsList = Arrays.asList(cols);
>
> Spinner s1 = (Spinner) findViewById(R.id.spinner_1);
>
> ArrayAdapter<String> ad = new ArrayAdapter<String>(this,
> android.R.layout.simple_spinner_item, colsAsList );
>
> ad.add("onother color"); // !!!!!!!!!!! here a
> java.lang.UnsupportedOperationException threw
>
> s1.setAdapter(ad);
>
> If a build by myself the List, works fine, but with Arrays.asList
> doesn't work.
>
>
> >
>
--
Romain Guy
www.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---