1
안녕하세요 저는이 주제에 대해 여전히이 문제를 해결할 수없는 많은 검색을했습니다. 저는 안드로이드에서 꽤 새로 생겼습니다. ExpandableListView에서 부모 위치를 얻지 못하고 있지만 childPosition 값을 얻고 있습니다. groupposition하지 않습니다.ExpandableListView ParentPosition을 가져 오지 못함
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;
}
});
답장을 보내 주셔서 감사합니다.하지만 변수에 해당 위치를 가져 오는 코드가 무엇인지 알려주십시오. String with childPosition = expListAdapter.getChild (groupPosition, childPosition); – user2384710
고마워 .. 사실 그 자리의 가치를 묻는 중이었습니다. 새 액티비티에 문자열로 값을 보내야 했으므로 – user2384710
@ user2384710 답변을 편집했습니다. 어댑터의 getChild() 메소드를 재정 의하여 사용해야합니다. 항목 그룹 및 하위 위치에 따라 올바른 데이터. – Antonio