First you have to realize that the list-item you want to find may not be visible. This means that using getChildAt on the list-view won't always work. But, if the list-item becomes visible later on, you need to make sure it'll reflect the change you made earlier for that item.
I think that the simplest way of doing this is, again, modifying the appropriate element stored in the adapter and then calling notifyDataSetChanged() on the adapter. Then in the Adapter's getView(...) method, which will be called for each visible elements in your list-view, you do the thing you need to do. In your implementation of getView(...) you may be able to detect if the list-item actually changed (e.g. use getTag() on the list-item- view). If not, just return the view provided to you by the getView (...) method, otherwise update this view with the changed data. On Jun 4, 6:31 am, "[email protected]" <[email protected]> wrote: > What if we have to find a single view down in the list > > On Jun 3, 7:20 pm, Streets Of Boston <[email protected]> wrote: > > > > > You have to do this through your BaseAdapter. > > Make sure that your BaseAdapter's individual elements/items have a > > variable that can determine if one is checked or not. > > > If you want to check-mark all your list-item item's, run through every > > element in your BaseAdapter. Set every element to 'isChecked' (or call > > whatever variable/method is available on your element's class to make > > it checked). > > > Then call the BaseAdapter's 'notifyDataSetChanged()'. > > This will cause your BaseAdapter's method 'getView(....)' to be called > > for all (visible) list-items: > > Using the 'position' (paramater of 'getView'), get the > > BaseAdapter's element on that position. > > Then query that element: if it is checked, check the list-view- > > item's checkbox. > > If not, clear this checkbox. > > > On Jun 2, 12:27 am, 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......??? > > > > .................................................. > > > .................................................. > > > public boolean onOptionsItemSelected(final MenuItem item) { > > > if (item == mSelectAllItem ) { > > > > LayoutInflater mInflater = LayoutInflater.from(this); > > > View view = (View)mInflater.inflate(R.layout.list_item, > > > null); > > > > ListView listView = getListView(); > > > > int listItemCount = listView.getChildCount(); > > > int listItemCount1 = listView.getCount(); > > > System.out.println("<<<<<<<<<Child Count in select > > > all>>>>>>>>>>"+listItemCount); > > > System.out.println("<<<<<<<<< Count in select > > > all>>>>>>>>>>"+listItemCount1); > > > for( int j=0;j<listItemCount;j++ ) > > > { > > > CheckBox cbox=(CheckBox)((View)listView.getChildAt > > > (j)).findViewById(R.id.alarmButton); > > > if( !cbox.isChecked() ) { > > > cbox.setChecked(true); > > > System.out.println("TRUE"); > > > } else { > > > System.out.println("FALSE"); > > > } > > > } > > > > return true; > > > }- Hide quoted text - > > > - Show quoted text -- 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 -~----------~----~----~----~------~----~------~--~---

