Wednesday, March 16, 2011

[android-developers] Re: Memory Allocation

You could store in an XML array file and inflate it each time spinner
is visible.

Like this:

Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.planets_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);

See here for more information: http://developer.android.com/resources/tutorials/views/hello-spinner.html

Bye!

On 15 Mar, 14:56, New Developer <secur...@isscp.com> wrote:
> When creating a spinner list that can be added to by the user over time.
> Is it best to store this in an  XML Array file
> <resources>
>     <!-- Used in View/Spinner1.java -->
>     <string-array name="colors">
>         <item>red</item>
>         <item>orange</item>
>
> Or in a text file and load the data  into an ArrayAdapter  each time the spinner is visible ?
>
> Also IF   I have three activities  (screens)
>
> When is the constructor     and   when is the destructor called ?
>
> How is the memory emptied for the ArrayAdapter ?  (Each time the screen is closed ?)
>
> thanks in advance

--
undefined

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment