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;
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---