Re: [android-developers] getViewTypeCount

2012-07-27 Thread Kumar Bibek
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

Re: [android-developers] getViewTypeCount

2012-07-27 Thread Justin Anderson
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

Re: [android-developers] getViewTypeCount

2012-07-27 Thread TreKing
On Fri, Jul 27, 2012 at 9:43 AM, bob b...@coolfone.comze.com wrote:

 Can someone help me understand why I must implement this method?  It seems
 like it should not be necessary to do this.


You don't *have* to. It's *not* necessary to do this.

On Fri, Jul 27, 2012 at 10:14 AM, Justin Anderson magouyaw...@gmail.comwrote:

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


FYI, that's unnecessary as that's the default implementation. You only need
to override it if you have more than the standard one view in your list.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

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

Re: [android-developers] getViewTypeCount

2012-07-27 Thread Justin Anderson

 On Fri, Jul 27, 2012 at 10:14 AM, Justin Anderson 
 magouyaw...@gmail.comwrote:

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


 FYI, that's unnecessary as that's the default implementation. You only
 need to override it if you have more than the standard one view in your
 list.


I was going off of this from his original post: public *abstract* int
getViewTypeCount ()
Whether or not you have to implement it would depend on what class you are
deriving from.  Based on the information he provided, he would have to
implement.

If he is subclassing a class that already implements that method then it is
correct that he doesn't need to implement it.

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


On Fri, Jul 27, 2012 at 9:56 AM, TreKing treking...@gmail.com wrote:

 On Fri, Jul 27, 2012 at 9:43 AM, bob b...@coolfone.comze.com wrote:

 Can someone help me understand why I must implement this method?  It
 seems like it should not be necessary to do this.


 You don't *have* to. It's *not* necessary to do this.


 On Fri, Jul 27, 2012 at 10:14 AM, Justin Anderson 
 magouyaw...@gmail.comwrote:

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


 FYI, that's unnecessary as that's the default implementation. You only
 need to override it if you have more than the standard one view in your
 list.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices


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

Re: [android-developers] getViewTypeCount

2012-07-27 Thread TreKing
On Fri, Jul 27, 2012 at 12:42 PM, Justin Anderson magouyaw...@gmail.comwrote:

 I was going off of this from his original post: public *abstract* int
 getViewTypeCount ()
 Whether or not you have to implement it would depend on what class you are
 deriving from.  Based on the information he provided, he would have to
 implement.


Ah, whoops, I missed that part. You're absolutely right. Please disregard
my original post.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

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