大家好我在这个主题上搜索了很多仍然无法解决这个问题。我在android中很新。我没有在我的ExpandableListView中获得Parent的位置,我得到的是childPosition的值而不是groupposition。
catlist = (ExpandableListView) findViewById(R.id.category_list);
final ExpandableListAdapter expListAdapter = new ExpandableListAdapter(
CatergoryActivity.this, groupList, expandableCategories);
catlist.setAdapter(expListAdapter);
catlist.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent,
View v, int groupPosition, int childPosition,
long id) {
Intent nextact = new Intent(CatergoryActivity.this,
MobileActivity.class);
String childPosition = expListAdapter.getChild(groupPosition, childPosition);
System.out.println("childPosition------------------------>>>>>>>>>>>>"+childPosition);
nextact.putExtra("locId", locId);
nextact.putExtra("childpos",
childList.get(childPosition));
nextact.putExtra("grouppos", gruopPosition);
startActivity(nextact);
return false;
}
});