7 messages in com.googlegroups.android-beginnersRe: ArrayAdapter ?
FromSent OnAttachments
Raul Bocter06 Feb 2008 13:07 
Dan U.06 Feb 2008 15:49 
Raul Bocter07 Feb 2008 03:05 
Dan U.07 Feb 2008 13:42 
Raul Bocter08 Feb 2008 05:16 
jl7413 Feb 2008 05:26 
Anil13 Feb 2008 11:16 
Subject:Re: ArrayAdapter ?
From:Dan U. (dan.@gmail.com)
Date:02/06/2008 03:49:15 PM
List:com.googlegroups.android-beginners

I haven't used ArrayAdapter, but I think the id is what is generated in R.java for your layout (i.e. R.layout.my_layout_xml.xml in your code).

If you are loading data into your spinner from a database, you probably wouldn't be using createFromResource. I think just use the constructor for ArrayAdapter if I understand the docs correctly.

On Feb 6, 1:08 pm, "Raul Bocter" <raul@gmail.com> wrote:

public
ArrayAdapter(Context<file:///C:/Program%20Files/Java/Google%20Android%20m3-RC3.7a/docs/reference/android/content/Context.html>context, int resource) Constructor Parameters context The current context. resource The resource ID for a layout file containing a TextView to use when instantiating views.

what does "ID for a layout file" mean ? A file does not have an ID. In the sample code, there is the following line:

ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.colors, android.R.layout.simple_spinner_item);

R.array.colors is an array defines in a file in the values directory. From all this I understand one cannot have a Spinner, for example, with data from a DB. There has to be a list of value defined in a resource file. If this is so, I find it stupid. If not, please tell me another way to build a Spinner. And another thing, it would be very useful for us, developers, to have a good help to reffer to.

regards,