Another scenario where you would use this is if you want to have sections
headers in your list...  For example, if you are displaying a list of
contacts in alphabetical order, you can have a section header every time
you get to a new letter when scrolling through the list.  In this case, you
would return 2.

If you only have a single type of item in your list, just implement this
and always return 1.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Fri, Jul 27, 2012 at 8:47 AM, Kumar Bibek <coomar....@gmail.com> wrote:

> This you would use if the list items are of different type, ie, one item
> could have a simple textview, and another could have a textview with a
> button, and provided you want to have a separate layout file for these two
> kinds of views.
>
>
> *Thanks and Regards,
> Kumar Bibek*
> *
> http://techdroid.kbeanie.com
> http://www.kbeanie.com*
>
>
>
>
> On Fri, Jul 27, 2012 at 8:13 PM, bob <b...@coolfone.comze.com> wrote:
>
>> I'm writing a class that implements ListAdapter.
>>
>> I'm looking at this method:
>>
>>
>> -----------------------------------
>> public abstract int getViewTypeCount ()
>> Since: API Level 1
>>
>> Returns the number of types of Views that will be created by getView(int,
>> View, ViewGroup). Each type represents a set of views that can be converted
>> in getView(int, View, ViewGroup). If the adapter always returns the same
>> type of View for all items, this method should return 1.
>> This method will only be called when when the adapter is set on the the
>> AdapterView.
>>
>> Returns
>> The number of types of Views that will be created by this adapter
>>
>> ------------------------------------
>>
>> Can someone help me understand why I must implement this method?  It
>> seems like it should not be necessary to do this.
>>
>>  --
>> 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
>
>
>  --
> 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
>

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

Reply via email to