You should be able to associate the group position, or group object using
"final" variables and/or view tags...
Something like:
getGroup() ...
{
final int groupPosFinal = groupPos;
imageView.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
...use groupPosFinal here ...
}
};
or
imageView.setOnClickListener(...
public void onClick(View view) {
GroupDataObject obj = view.getTag();
}
}
imageView.setTag(groupDataObject);
-- K
2013/5/19 Etienne <[email protected]>
> So my ExpandableListView has group rows that are defined like :
>
> *group_row.xml*
>
> <?xml version="1.0" encoding="utf-8"?><RelativeLayout
> xmlns:android="http://schemas.android.com/apk/res/android"
> android:layout_width="match_parent"
> android:layout_height="match_parent" >
>
> <TextView
> android:id="@+id/GroupName"
> style="@style/ListViewRowStyle"
> android:paddingLeft="40dp"
> android:textSize="18sp" >
> </TextView>
>
> <ImageView
> android:id="@+id/Menu"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_alignParentRight="true"
> android:layout_marginTop="10dp"
> android:contentDescription="@string/default_content_description_text"
> android:src="@drawable/ic_menu_moreoverflow_normal_holo_light" >
> </ImageView>
> </RelativeLayout>
>
> When you click on the TextView it will expand or collapse depending on
> whether or not the child rows are currently displayed. I have attached an
> OnClickListener to the ImageView in the group row. When this ImageView is
> clicked I launch a PopupMenu like the images below :
>
> [image: enter image description here]
>
> [image: enter image description here]
>
> Once the PopupMenu is displayed and one of the actions is clicked, I
> would like to perform an action on all children of the group. The problem
> is that I cannot determine the row in which the ImageView was clicked.
>
> The only way I have figured out how to apply an action to all children is
> with a ContextMenu like the image below :
>
> [image: enter image description here]
>
> I want to avoid using a ContextMenu because a LongClick on a group row
> may not be obvious for a user to figure out that it would bring up some
> actions to perform on the children rows. I think the more obvious design is
> to anchor a PopupMenu to an ImageView (in my case a menu icon) and have
> the action be applied to the children rows of that group. How can I get
> this functionality with a PopupMenu ?
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.