je veux bien convertir les cols cursor pour des string array pour pouvoir l utiliser avec un exemple que j ai trouve


voila la class des donnees static dans l exemple

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 class StaticImageData {
 
	private static ImageItem[] mImageItemArray;
 
	private static int[] imageResIds = {R.drawable.android,
		R.drawable.hamburger, R.drawable.globe, R.drawable.notepad,
		R.drawable.play, R.drawable.sun, R.drawable.tux, R.drawable.yawn};
	private static String[] imageTitles = {"Android", "Burger", "Globe",
		"Note Pad", "Play", "Sun", "Tux", "Yahh!"};
 
	/**
         * Default image to show
         */
	public static final int DEFAULT_IMAGE_INDEX = 0;
 
	/**
         * @return static instance of the image item array
         */
	public static ImageItem[] getImageItemArrayInstance() {
		if (mImageItemArray == null) {
			mImageItemArray = new ImageItem[imageResIds.length];
 
			for (int i = 0; i < mImageItemArray.length; i++) {
				ImageItem imageItem = new ImageItem(imageTitles[i], imageResIds[i]);
				mImageItemArray[i] = imageItem;
			}
		}
		return mImageItemArray;
	}
 
 
}

je veux bien remplacer les cols imageResIds et imageTitles par les miens

voila le getalldata de puis ma DB


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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
public  VerbItem[] getAllVerbs() {
	final SQLiteDatabase db = MyDbHelper.getReadableDatabase();
    Cursor cursor = null;
    ArrayList<VerbItem> myverbs = new ArrayList<VerbItem>();
    try {
        cursor = db.query(MyTables.TABLE_VERBS,
                          VerbsQuery.PROJECTION,
                          null, null, null, null, null);
        if (cursor.moveToFirst()) {
            do {
            	VerbItem page = new VerbItem(
                                     cursor.getInt(VerbsQuery.TAG_ID_VERB_COL),
                                     cursor.getInt(VerbsQuery.TAG_ID_PAGE_COL),
                                     cursor.getString(VerbsQuery.TAG_VERB_COL),
                                     cursor.getString(VerbsQuery.TAG_TEMP1_COL),
                                     cursor.getString(VerbsQuery.TAG_TEMP2_COL),
                                     cursor.getString(VerbsQuery.TAG_TEMP3_COL),
                                     cursor.getString(VerbsQuery.TAG_TRAD_COL),
                                     cursor.getString(VerbsQuery.TAG_EXEMPL_COL),
                                     cursor.getString(VerbsQuery.TAG_V_IMAG_COL),
                                     cursor.getString(VerbsQuery.TAG_VAR1_COL));
            	myverbs.add(page);
            } while (cursor.moveToNext());
        }
 
        VerbItem.setCount(cursor.getCount());
 
        Log.i(TAG, "c: "+ cursor.getCount());
 
        return myverbs.toArray(new VerbItem[myverbs.size()]);
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }
}
 
 
 
	  public interface VerbsQuery {
	        int _TOKEN = 0x4;
	    String TBN = MyTables.TABLE_VERBS;
 
	        String[] PROJECTION = {
	        		MyTables.ID_VERB_COL,
	        		MyTables.ID_PAGE_COL,
	        		MyTables.VERB_COL,
	        		MyTables.TEMP1_COL,
	        		MyTables.TEMP2_COL,
	        		MyTables.TEMP3_COL,
	        		MyTables.TRAD_COL,
	        		MyTables.EXEMPL_COL,
	        		MyTables.V_IMAG_COL,
	        		MyTables.VAR1_COL,
	        };
 
	        int TAG_ID_VERB_COL = 0;
	        int TAG_ID_PAGE_COL = 1;
	        int TAG_VERB_COL = 2;
	        int TAG_TEMP1_COL = 3;
	        int TAG_TEMP2_COL = 4;
	        int TAG_TEMP3_COL = 5;
	        int TAG_TRAD_COL = 6;
	        int TAG_EXEMPL_COL = 7;
	        int TAG_V_IMAG_COL =8;
	        int TAG_VAR1_COL =9;
	    }
 
 
 
	}