The following is my code but some how it is not displaying String
which is inside List<String>. and when i click on spinner it hangs
somehow.

Spinner s1=new Spinner(this);


                //String cityNames[]={"a","b","c"};
                //String bankName[]=(String[])bankList.toArray();
                //String banks[]=new String[bankList.size()];
                ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, bankList);
                //ArrayAdapter<ArrayList<String>>= new
ArrayAdapter<ArrayList<String>>
(this,android.R.layout.simple_spinner_item,bankList);
                //android.R.layout.simple_expandable_list_item_1
                s1.setAdapter(adapter);
                layout.addView(s1);

On Aug 19, 3:39 pm, Mark Murphy <[email protected]> wrote:
> Honest wrote:
> > I want to add String values in spinner at run time. My problem is that
> > the value is not available in res file. Can some one tell me how can i
> > do it ? I just want to insert one String array or simple String run
> > time in Spinner.
>
> Step #1: Put your initial values in an ArrayList<String>
>
> Step #2: Wrap the ArrayList<String> in an ArrayAdapter<String>
>
> Step #3: Give the ArrayAdapter<String> to the spinner
>
> Step #4: When you want to modify the contents of the spinner, use the
> methods on ArrayAdapter to do so
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _The Busy Coders' Guide to *Advanced* Android Development_ In Print!
--~--~---------~--~----~------------~-------~--~----~
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