Like Romain said, the number of items in the entire list is not the
same as the number of child-views of the list.

You should know the number of items in the list. You (your code) put
the items in the list. If you use a list-adapter (Adapter,
BaseAdapter, etc) to provide the data for creating all the list-items,
do a 'getCount()' on this adapter. In other words, go to the code/
class that provides the data for your list and ask that code/class how
many items it provides for your list. That's the number you want.

As for the number of child-views: This number more-or-less corresponds
to the number of *visible* list-items in your list. E.g. if you list
contains 1000 items and about 6 are visible at any given time, the
call to listView.getChildCount() would return a number around 6.

On Jun 2, 3:12 am, dark_messiah <[email protected]> wrote:
> @ Roman Guy
> So whats the solution for my problem...i need to select all the views
> in listview using checkbox...plz help
>
> On Jun 2, 11:57 am, Romain Guy <[email protected]> wrote:
>
>
>
> > No, the report is correct. The number of views in the ListView is
> > different from the number of items in the adapter.
>
> > On Mon, Jun 1, 2009 at 10:11 PM, dark_messiah
>
> > <[email protected]> wrote:
>
> > > No the the childcount i m getting is not correct...there are 12 views
> > > in the listview..but the count i m getting is 8...
>
> > > On Jun 2, 9:50 am, Marco Nelissen <[email protected]> wrote:
> > >> On Mon, Jun 1, 2009 at 9:27 PM, dark_messiah 
> > >> <[email protected]>wrote:
>
> > >> > I have problem...i m using a base adapter for binding a data from
> > >> > array to listview....the listview has a checkbox with it...i wanted to
> > >> > create a menu to select all or deselect all view inside that
> > >> > list...but the getchildCount method is behaving abnormally..i m not
> > >> > able to get the correct child count...can anybody help me plz......???
>
> > >> I'm pretty sure that the reported child count is correct. What value is 
> > >> it
> > >> reporting, and what value were you expecting?
>
> > --
> > Romain Guy
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them- Hide quoted text 
> > -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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