我想知道,我怎样才能得到被点击的对象ExpandableListView
我有一个BaseExpandableListAdapter
,这是我的方法:
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final Foo children = (Foo) getChild(groupPosition, childPosition);
if (convertView == null) {
convertView = inflater.inflate(R.layout.list_item, null);
}
// view stuff
convertView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// how to get the clicked child object of type Foo?
}
});
convertView.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
// also how to get it here?
return true;
}
});
return convertView;
}
如何获取Foo
单击和长单击侦听器的子元素类型?