Bonjour à tous !

Voilà je développe une appli Android pour les cours, et je cherche à lister l'intégralité du contenu d'un cursor dans un TableLayout.
Pour ce faire, je me suis inspiré de tuto, appli et autres trouvé sur le net.

Voilà la fonction qui permet d'afficher le TableLayout, prenant en paramètre le cursor contenant toutes mes données :
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
26
27
28
29
30
31
32
33
public void showItem(Cursor c) {
		// TODO Auto-generated method stub
		final TableLayout itemTable = (TableLayout)findViewById(R.id.TableLayout_ItemList);
 
		if(c.moveToFirst()){
			for (int i = 0; i< c.getCount(); i++){
				TableRow newRow = new TableRow(this);
				TextView nameCol = new TextView(this);
				TextView quantityCol = new TextView(this);
				Button editButton = new Button(this);
 
				newRow.setTag(c.getInt(c.getColumnIndex(ItemDB.COL_ID)));
				nameCol.setText(c.getString(c.getColumnIndex(ItemDB.COL_NAME)));
				quantityCol.setText(c.getString(c.getColumnIndex(ItemDB.COL_QUANTITY)));
 
				editButton.setText("Edit");
				editButton.setTag(c.getInt(c.getColumnIndex(ItemDB.COL_ID)));
 
				newRow.addView(nameCol);
				newRow.addView(quantityCol);
				newRow.addView(editButton);
                                // le problème se situe au niveau de la ligne suivante
				itemTable.addView(newRow);
				c.moveToNext();
			}
		}
		else{
			TableRow newRow = new TableRow(this);
			TextView noResults = new TextView(this);
			noResults.setText("No item to show");
		}
		c.close();
	}
Voilà, je suis assez (beaucoup) novice en développement Android, si vous avez besoin de plus d'information, n'hésitez pas à demander.

Merci beaucoup de votre attention
bon dimanche !