tag:blogger.com,1999:blog-8214401912480503366.post3268997264559952483..comments2023-08-10T13:35:15.093+02:00Comments on My life with Android :-): Expandable lists and check boxesGabor Pallerhttp://www.blogger.com/profile/14307475522972458932noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-8214401912480503366.post-82051724120170459422017-09-01T13:51:11.156+02:002017-09-01T13:51:11.156+02:00Thanks..I've been looking for the solution fro...Thanks..I've been looking for the solution from past 3 hrs ....finally this one worked for mevj7https://www.blogger.com/profile/00127603584883285763noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-43174275433205185602013-03-14T02:44:23.212+01:002013-03-14T02:44:23.212+01:00Great post!!! Helps a whole lot!!!Great post!!! Helps a whole lot!!!Anonymoushttps://www.blogger.com/profile/09237902480810764560noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-88654996729788803262012-03-12T04:03:11.555+01:002012-03-12T04:03:11.555+01:00Can I change check boxes to spinner using Expandab...Can I change check boxes to spinner using Expandable list?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-44096754437797572832012-02-19T17:44:21.858+01:002012-02-19T17:44:21.858+01:00Dexter, there is an update at the end of the post,...Dexter, there is an update at the end of the post, pointing to another post. Does that help?Gabor Pallerhttps://www.blogger.com/profile/02390936870056951146noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-37131392882944108312012-02-19T16:30:05.907+01:002012-02-19T16:30:05.907+01:00Hi Gabor!
Thanks for replying.
The problem is th...Hi Gabor!<br /><br />Thanks for replying.<br /><br />The problem is that when i check a box i one group, it randomly gets checked in other groups. <br /><br />Why is that?<br /><br />What i want is to have a settingslist using expandablelist with checkboxes and then save the the settings for the application in a list, that i can save on the sd-card later on. <br />And at restart i want the same checkboxes to be checked (read from the list and check the boxes). <br /><br />You have any ide? <br /><br />Thanks!<br /><br />/Dexter (Anonymous from above)Dexternoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-26990140274124748892012-02-19T13:46:29.046+01:002012-02-19T13:46:29.046+01:00Anonymous, what is the problem with the example pr...Anonymous, what is the problem with the example program?Gabor Pallerhttps://www.blogger.com/profile/02390936870056951146noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-63979528248094309532012-02-18T23:50:24.435+01:002012-02-18T23:50:24.435+01:00Hi, can someone please post a working code example...Hi, can someone please post a working code example? I can´t get it to work, aargh!<br /><br />Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-74312430589499037372011-12-27T18:21:34.098+01:002011-12-27T18:21:34.098+01:00Is there any possibility to set the state of every...Is there any possibility to set the state of every single checkbox, like setting a list in the java code for the checkboxes?Android_Newbienoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-14162804980900314472011-12-21T11:11:20.873+01:002011-12-21T11:11:20.873+01:00Hi
very nice explanation of the Expandable listvie...Hi<br />very nice explanation of the Expandable listview and could you please let me know how to set an listener to child node, suppose that I want to have phone number in child node and clicking on the childnode should trigger an phone call to that number. But I am not able to set an listener for childnode. Looking forward to your reply.<br />thanks.Mukunda SreenivasaMurthyhttps://www.blogger.com/profile/08260900587675182292noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-41550259620863384212011-12-20T15:26:17.937+01:002011-12-20T15:26:17.937+01:00Response to Anonymous comment (from December 20, 2...Response to Anonymous comment (from December 20, 2011 2:39 PM)<br /><br />This seems to solve the problem (for about 95% of the time):<br /><br />int position = 0;<br />listView.setItemChecked(position, true);<br />if (position == 0) {<br />// scroll to the top, to prevent the bug where the list view stops responding to touch events<br />listView.setSelectionFromTop(0, 0);<br />}<br /><br />Source: <br />http://stackoverflow.com/questions/3014089/scroll-to-a-position-in-a-listviewAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-49705393366833965152011-12-20T14:39:48.466+01:002011-12-20T14:39:48.466+01:00Your code is great, but I've found an Android ...Your code is great, but I've found an Android bug when trying to programmatically set a list position:<br /><br />First enable this: listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);<br /><br />Then use listView.setItemChecked(listRowPosition, true);<br /><br />to set a list row on "on".<br /><br />But a problem happens when you do this:<br /><br />1) Scroll to the end of a long list.<br />2) Call listView.setItemChecked(0, true);<br />3) Scroll to the top of the list, then scroll down a bit.<br /><br />4) Now you will see that the list no longer responds to touch events when you touch the list row.<br /><br />I don't know why this happens.<br /><br />Can anyone explain this, or figure out how to re-enable touch events on the list?<br /><br />Note: Similar problem reported here: http://stackoverflow.com/q/8149301Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-25384615826326263372011-11-02T12:10:57.421+01:002011-11-02T12:10:57.421+01:00Anonymous, have you checked the update section at ...Anonymous, have you checked the update section at the end of the post?Gabor Pallerhttps://www.blogger.com/profile/14307475522972458932noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-25571064652815938012011-11-02T04:45:51.371+01:002011-11-02T04:45:51.371+01:00Can somebody give the link to a working sample. I ...Can somebody give the link to a working sample. I need an expandable list with Childs having checkbox [Same as what shown in this example]. But I have problem in maintaining checkbox states. I seen posts which says we need to override getView method. But if somebody upload a working copy, then it wud be great for new learner like me. Thanks to all you already contributed more in thread. Thanks in advance for who upload a working sample.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-65407569173415680522011-09-16T23:20:18.212+02:002011-09-16T23:20:18.212+02:00Thanks! This tutorial is really really useful. Wel...Thanks! This tutorial is really really useful. Well done.<br /><br />There is NOTHING in Google's documentation that explains this.<br /><br />Before I discovered this blog article, it took me a long time to investigate this issue... without a solution. Now I have a solution. Many thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-24075898363192628672011-07-13T04:29:30.554+02:002011-07-13T04:29:30.554+02:00expandablelistview works well, thank for your code...expandablelistview works well, thank for your code ! <br />Now , i can save infor to xml file and write my setting app !Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-9211220107752870602011-07-09T06:26:20.908+02:002011-07-09T06:26:20.908+02:00thank for share:-)thank for share:-)xuannvhttps://www.blogger.com/profile/14772410376454648443noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-78087175990171823482011-07-09T01:28:30.788+02:002011-07-09T01:28:30.788+02:00Ankur, I fixed the persistence when the checkbox i...Ankur, I fixed the persistence when the checkbox is checked by adding a setOnClickListener callback in the getChildView method:<br /><br /> public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {<br /> View v = null;<br /> if( convertView != null )<br /> v = convertView;<br /> else<br /> v = inflater.inflate(R.layout.child_row, parent, false); <br /> <b>final</b> Color c = (Color)getChild( groupPosition, childPosition );<br /> TextView color = (TextView)v.findViewById( R.id.childname );<br /> if( color != null )<br /> color.setText( c.getColor() );<br /> TextView rgb = (TextView)v.findViewById( R.id.rgb );<br /> if( rgb != null )<br /> rgb.setText( c.getRgb() );<br /> final CheckBox cb = (CheckBox)v.findViewById( R.id.check1 );<br /> cb.setChecked( c.getState() );<br /><b><br /> cb.setOnClickListener(new View.OnClickListener() {<br /> <br /> @Override<br /> public void onClick(View v) {<br /> c.state = cb.isChecked();<br /> }<br /> });<br /></b><br /> return v;<br /> }<br /><br />In the onChildClick() add something similar:<br /><b><br /> final Color c = (Color)expListAdapter.getChild( groupPosition, childPosition );<br /> c.state = cb.isChecked();</b>Unknownhttps://www.blogger.com/profile/03717854790770166992noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-43866045640329266702011-04-26T04:03:10.972+02:002011-04-26T04:03:10.972+02:00Hi Gabor,
You have mentioned in this post that...Hi Gabor,<br /><br /> You have mentioned in this post that check box does not behave properly and you have provided the hack in the onChildClick method. It works as you said and the checkBox state gets toggled as soon as I click on the child row. However, when I click on the checkbox only and not the row, the checkbox state gets changed but no onClildClick event gets fired. Any idea why?<br />Also, I tried adding a onclick event on check box. But that only gives me the view object as the argument of method and there is no way to find out the position of the checkbox and group number it belongs to, so that i can update the right object in the group for persisting the change.<br /><br />thank you .<br /><br />AnkurAnkur Jainhttps://www.blogger.com/profile/14880753124666951532noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-90660411307021887992011-02-23T17:56:13.935+01:002011-02-23T17:56:13.935+01:00Droid-bird, there is an update section at the end ...Droid-bird, there is an update section at the end of the post.Gabor Pallerhttps://www.blogger.com/profile/14307475522972458932noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-69277232353741020552011-02-23T16:34:21.266+01:002011-02-23T16:34:21.266+01:00Can someone please upload a working version? I cou...Can someone please upload a working version? I could not figure out anything from the discussion.<br /><br />For me, it is still randomly changing! :(Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-38046598123370514782011-02-23T09:52:55.306+01:002011-02-23T09:52:55.306+01:00thank uthank usrihttps://www.blogger.com/profile/05365735756876521671noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-66753476000671336852011-02-23T09:16:41.047+01:002011-02-23T09:16:41.047+01:00sri, what about using View.setVisibility() to make...sri, what about using View.setVisibility() to make the sub-view appear/disappear? (then do a requestLayout() on the ListView after the visibility update)Gabor Pallerhttps://www.blogger.com/profile/14307475522972458932noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-54585371477029995472011-02-23T07:09:06.460+01:002011-02-23T07:09:06.460+01:00thank you.
I am Having another query ..
can i have...thank you.<br />I am Having another query ..<br />can i have code for resizing the listview item to zerosrihttps://www.blogger.com/profile/05365735756876521671noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-84585801244285061292011-02-22T15:34:04.662+01:002011-02-22T15:34:04.662+01:00sri, can't you just reuse the same approach as...sri, can't you just reuse the same approach <a href="http://mylifewithandroid.blogspot.com/2010/03/progressively-loading-listviews.html" rel="nofollow">as for normal lists?</a>Gabor Pallerhttps://www.blogger.com/profile/14307475522972458932noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-42863504903383026622011-02-22T10:28:43.796+01:002011-02-22T10:28:43.796+01:00I am having a same problem with ExpandableListView...I am having a same problem with ExpandableListView with check if anyone of you have solution, please provide the codeNyannoreply@blogger.com