Tuesday, 1 October 2013

how to get view of group in expandablelistview in android?

how to get view of group in expandablelistview in android?

im blazilian so, my english is not good.
So.. i need get view of group in expandablelistview for get your object
tag throught view.getTag() method.
follow me in this example:
ExpandableListView
--> group (i need this view)
----> child
----> child
----> child
--> group (i need this view)
----> child
----> child
My code:
@Override
public boolean onChildClick(final ExpandableListView parent, final View v,
final int groupPosition, final int childPosition, final long id) {
/* I NEED GET VIEW OF GROUP FOR GET YOUR TAG*/
View vParent = parent.getChildAt(groupPosition); // dont work
after first group
Programa v2 = (Programa) parent.getTag(); // return null
// v parameter is a child of group
return true;
}
in my adapter:
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
TwoLineListItem view = (TwoLineListItem) LayoutInflater.from(contexto)
.inflate(android.R.layout.simple_expandable_list_item_2,
parent, false);
String programa = map.keySet().toArray(new
String[map.keySet().size()])[groupPosition];
view.getText1().setText(programa);
view.getText2().setText("PROGRAMA LOCAL");
view.setTag(programas.get(groupPosition)); // i need get this in child
click listener
return convertView = view;
}
any idea? thanks

No comments:

Post a Comment