Bonsoir,
C'est vrai que j'ai trouvé quelques tuto sur le fait de créer une barre de recherche pour la listview. Parmi ceux que j'ai suivi : http://www.androidhive.info/2012/09/...y-to-listview/ . Le code marche bien mais je n'arrive pas à l'adapter à ma liste. j'ai été obligé de refaire mon projet de 0 car j'ai tout chamboulé. Je suis débutante, j'ai besoin d'aide . Voici un bout de code de comment j'ai crée ma liste:
Et ce que contient ShoppingListHelper.java :
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 final ListView listViewCatalog = (ListView) findViewById(R.id.ListViewCatalog); mProductAdapter = new ProduitAdapter(mCartList, getLayoutInflater(), true); listViewCatalog.setAdapter(mProductAdapter); listViewCatalog.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent productDetailsIntent = new Intent(getBaseContext(),ProduitDetailsActivity.class); productDetailsIntent.putExtra(ShoppingListHelper.PRODUCT_INDEX, position); startActivity(productDetailsIntent); } }); }
j'utilise eclipse JUNO.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 public static List<Produit> getCatalog(Resources res){ if(catalog == null) { catalog = new Vector<Produit>(); catalog.add(new Produit("Nutella", res .getDrawable(R.drawable.nutella), "Pate à tartiner au chocolat, au bon goût de noisettes", 750)); } return catalog; }
Merci d'avance.
Partager