When we use ExpandableListView, click a GroupView to expand the ChidView. At this time, the size of the Adapter changes. For example, suppose there are 20 groupviews, and each GroupView has a ChildView. When all groupviews are not expanded, the size of the Adapter is 20. When we expand a GroupView and show a ChildView, the size of the Adapter increases by 1. This must be understood. When we need to add a long-pressed GroupView to obtain the object of the currently long-pressed GroupView, the following problem occurs when we use the following method. [Java] @ Override public void onCreateContextMenu (ContextMenu menu, View v, ContextMenuInfo menuInfo) {super. onCreateContextMenu (menu, v, menuInfo); MenuInflater inflater = getMenuInflater (); inflater. inflate (R. menu. booklist_context, menu); ExpandableListView. expandableListContextMenuInfo info = (ExpandableListView. expandableListContextMenuInfo) menuInfo; // obtain the subscript final int index = ExpandableL IstView. getPackedPositionGroup (info. packedPosition .); // System. out. println ("index ----------->" + index); // System. out. println ("Adapter size ------------->" + expListView. getAdapter (). getCount (); mBookInfo = (BookInfoDTO) expListView. getAdapter (). getitem (index);} 1. When all groupviews are not expanded, the subscript of each GroupView can be correctly obtained and the object bound to this GroupView can be obtained through the Adapter. 2. However, when some groupviews are expanded, you cannot use the above method to obtain the objects bound to GroupView. The reason is shown above, because the size of the Adapter has been changed. The obtained subscript is the relative subscript of 20 groupviews. The object corresponding to the subscript In the Adapter is inconsistent, because the Adapter also contains the expanded ChildView. Use the following methods to solve the problem. [Java] @ Override public void onCreateContextMenu (ContextMenu menu, View v, ContextMenuInfo menuInfo) {super. onCreateContextMenu (menu, v, menuInfo); MenuInflater inflater = getMenuInflater (); inflater. inflate (R. menu. booklist_context, menu); ExpandableListView. expandableListContextMenuInfo info = (ExpandableListView. expandableListContextMenuInfo) menuInfo; View vin = (view1_info.tar getView; mBookInfo = (BookInfoDTO) vin. getTag ();} in the settings object, set a Tag for each GroupView, that is, the object proposed when we need to press for a long time. In this way, we can retrieve the Tag in each GroupView in the above method, that is, the object we bind to GroupView. In this way, you do not need to rely on the changed Index.