Monday, December 20, 2010

[android-developers] onClick for ExpandableListAdapter

I would like to invoke a function when a child is clicked within a
ExpandableListAdapter

The children are ViewHolders.

Below is my getChildView from myExpandableListAdapter class.

it reacts to Long clicks, but i can't figure out how to also get it to
react to a short click.

Thanks
Kevin

public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {

ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listview, null);
holder = new ViewHolder();
holder.text = (TextView) convertView
.findViewById(R.id.TextView01);
holder.text2 = (TextView) convertView
.findViewById(R.id.TextView02);
holder.text3 = (TextView) convertView
.findViewById(R.id.TextView03);
convertView.setTag(holder);
} else {
convertView.setClickable(true);
holder = (ViewHolder) convertView.getTag();
}


holder.text.setText(children.get(groupPosition).get(childPosition)
.get(0));
holder.text2.setText(children.get(groupPosition).get(childPosition)
.get(1));
holder.text3.setText(children.get(groupPosition).get(childPosition)
.get(2));

return convertView;
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment