Ray Tayek wrote:

> At 04:21 AM 3/29/2012, you wrote:
> >...  If I can just successfully (i.e.,
> >without a force close) get that List<x> to x[] (where 'x' is String,
> >Integer, etc.), I could then feed that to the ArrayAdapter and "feed"
> >the Spinner. ...
>
> list.toArray(new String[0])
>

>From the API docs for 'toArray(T[] a)':
ArrayStoreException<http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayStoreException.html>
 - 
if the runtime type of the specified array is not a supertype of the 
runtime type of every element in this list

The OP's original list variable was 'bar' but they never told us the type 
of that variable. What they said was:

>  String[] foo = (String[]) bar.toArray();

> And this caused a force close, where the error stated that you can't
> cast toArray() to String[].
If 'bar' is of type 'String[]' then, of course, your tip will work 
perfectly.

-- 
Lew


-- 
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

Reply via email to