android - setOnChildClickListener of expandablelistview doesn't take action -
i newbie android development .
my goal make expandable list view , on each child of group of expandable
list view want set event when child clicked.
so have downloaded ready android project here .
http://mylifewithandroid.blogspot.com/2011/06/hiding-group-indicator-for-empty-groups.html
and run eclipse ide .
i add code explist3 class test event.
but no event gained when press child of list view group
getexpandablelistview().setonchildclicklistener(new onchildclicklistener() { @override public boolean onchildclick(expandablelistview arg0, view v, int groupposition, int childposition, long id) { if(groupposition==0&&childposition==0 ) { textview mytextview = (textview)findviewbyid(r.id.groupname); mytextview.settext("text changed"); } else if(groupposition==0&&childposition==1) { textview mytextview = (textview)findviewbyid(r.id.groupname); mytextview.settext("text changed"); } else if(groupposition==1&&childposition==0&&id==0) { textview mytextview = (textview)findviewbyid(r.id.groupname); mytextview.settext("text clicked"); } return false; } });
you have used textview , setting clicked list item in textview. use toast view clicked item. location of textview matters in displaying clicked item.
Comments
Post a Comment