J'ai construit une ExpandableListView des recherches en suivant les instructions à Android ExpandableListView Search Filter Example mais je me bats pour sélectionner l'enfant lors de l'utilisation correcte Au moment onChildClick()ExpandableListView Filtre de recherche
J'utilise le code ci-dessous pour sélectionner et envoyer le informations à une nouvelle intention. Cependant, lorsqu'un filtre de recherche est appliqué, les informations de l'enfant d'origine dans cette position sont envoyées, et non de l'enfant de la liste filtrée.
myList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Object a = continentList.get(groupPosition).getCountryList().get(childPosition).getCode();
Object b = continentList.get(groupPosition).getCountryList().get(childPosition).getName();
Object c = continentList.get(groupPosition).getCountryList().get(childPosition).getPopulation();
// Start new intent
Intent intent = new Intent(SearchActivity.this, DisplayCountry.class);
intent.putExtra("code", ""+ a);
intent.putExtra("name", "" + c);
intent.putExtra("population", "" + b);
startActivity(intent);
return true;
}
});
Vous aviez raison dans votre hypothèse! En utilisant les méthodes de l'adaptateur à la place résolu le problème. –