Salut,
Ça fait deux jours que je cherche sur le net, j'ai essayé pleins d'exemples, mais aucun ne marche !!!
j'ai une ListView je souhaite utiliser le fameux SearchView.

bout de code qui fait la recherche :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
//fontion qui met les contacts dans la liste
 //Put contacts in the list (phoneContactsList)
        dumpContact();
 
/***recherche par nom************************/
        phoneContactsList.setTextFilterEnabled(true);
        inputSearch = (SearchView) this.findViewById(R.id.searchText);
        inputSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                return false;
            }
 
            @Override
            public boolean onQueryTextChange(String newText) {
                if (newText == null || newText.equals("")) {
                    phoneContactsList.clearTextFilter();
                } else {
                    phoneContactsList.setFilterText(newText);
                }
                return false;
            }
        });
        /***fin recherche par nom************************/
j'ai mis dans le manifest : j'ai crée auparavant le /xml/searchable.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
<intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
            <meta-data android:name="android.app.searchable"
                android:resource="@xml/searchable" />
voici le résultat :
Nom : Sélection_080.png
Affichages : 241
Taille : 10,6 Ko
Merci d'avance