Sure you can do that. There can be as many number of ViewTypes you want. And as many layouts. Also, you can create the views at runtime, depending on the requirement.
There are a few methods in the BaseAdapter class which will help you. Search for them (getItemViewType or something) http://groups.google.com/group/android-developers/browse_thread/thread/1e3419b1254e3a19/d8ca550751b4a8fa?lnk=gst&q=getItemViewType On Oct 21, 10:59 am, Peter Webb <r.peter.w...@gmail.com> wrote: > All of the examples of the use of ListView and similar controls that I > can find assume a fixed number of field names coded into @strings or > similar, and retrieved through R.layout functions. > > I want to dynamically create ListViews, Linear Layouts, Spinners etc > of variable length, and contents determined at run time. > > I assume this is possible. Various appraoches occur to me: > > Extend ListView with a custom creator that pre-populates with the > runtime determined field > names.http://developer.android.com/resources/tutorials/views/hello-listview... > gives a hint on how to do it, whilst not directly addressing the > question. > > I could try and take out the requirement to go through R.layout, and > directly reference some other data structure > > And some others. > > However, this must be a very common design pattern, can anyone tell me > the recommended approach for allocating the number of items in (say) a > List View and their content at runtime ? > > Thanks > > Peter Webb -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en