知りたかったのですが、クリックされたオブジェクトを取得するにはどうすればよいですか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
クリックおよびロングクリックリスナーのタイプの子要素を取得する方法は?