Bonjour pourriez vous m aider ?
j ai ce message d erreur :
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 06-06 23:37:11.320 11368-11368/com.example.alexa.marieteam I/art: Late-enabling -Xcheck:jni 06-06 23:37:11.320 11368-11368/com.example.alexa.marieteam D/houdini: [11368] Initialize library(version: 5.0.7a_y.48167 RELEASE)... successfully. 06-06 23:37:15.791 11368-11368/com.example.alexa.marieteam V/Monotype: SetAppTypeFace- try to flip, app = com.example.alexa.marieteam 06-06 23:37:15.796 11368-11368/com.example.alexa.marieteam V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default 06-06 23:37:15.801 11368-11368/com.example.alexa.marieteam V/Monotype: SetAppTypeFace- try to flip, app = com.example.alexa.marieteam 06-06 23:37:15.801 11368-11368/com.example.alexa.marieteam V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default 06-06 23:37:15.835 11368-11368/com.example.alexa.marieteam V/Monotype: SetAppTypeFace- try to flip, app = com.example.alexa.marieteam 06-06 23:37:15.835 11368-11368/com.example.alexa.marieteam V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default 06-06 23:37:15.991 11368-11368/com.example.alexa.marieteam I/System.out: LE CURSEUR VAUT android.database.sqlite.SQLiteCursor@2891e3bf 06-06 23:37:15.992 11368-11368/com.example.alexa.marieteam D/AndroidRuntime: Shutting down VM 06-06 23:37:15.992 11368-11368/com.example.alexa.marieteam E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.alexa.marieteam, PID: 11368 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.alexa.marieteam/com.example.alexa.marieteam.MainActivity}: java.lang.IllegalArgumentException: column '_id' does not exist at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:147) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5264) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695) Caused by: java.lang.IllegalArgumentException: column '_id' does not exist at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:303) at android.widget.CursorAdapter.init(CursorAdapter.java:172) at android.widget.CursorAdapter.<init>(CursorAdapter.java:120) at android.widget.ResourceCursorAdapter.<init>(ResourceCursorAdapter.java:52) at android.widget.SimpleCursorAdapter.<init>(SimpleCursorAdapter.java:78) at com.example.alexa.marieteam.MainActivity.onCreate(MainActivity.java:87) at android.app.Activity.performCreate(Activity.java:5975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)* at android.app.ActivityThread.access$800(ActivityThread.java:147)* at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)* at android.os.Handler.dispatchMessage(Handler.java:102)* at android.os.Looper.loop(Looper.java:135)* at android.app.ActivityThread.main(ActivityThread.java:5264)* at java.lang.reflect.Method.invoke(Native Method)* at java.lang.reflect.Method.invoke(Method.java:372)* at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)* at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)* 06-06 23:37:17.674 11368-11368/com.example.alexa.marieteam I/Process: Sending signal. PID: 11368 SIG: 9
pour ces classes :
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 package com.example.alexa.marieteam; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class Bateau extends AppCompatActivity { public Bateau(String lenom){ this.nom=lenom; } public Bateau(){ } public Bateau(String lenom ,int laLargeur , int laHauteur){ this.nom =lenom; this.largeurBateau=laLargeur; this.hauteurBateau=laHauteur; } public int getId(){ return this.id_Bateau ; } public String getNom(){ return this.nom ; } public void setId(int lId){ this.id_Bateau=lId ; } public void setNom(String unNom){ this.nom=unNom ; } public String getclasseBateau(){ return this.classeBateau ; } protected int id_Bateau ; protected String nom ; protected int largeurBateau; protected int hauteurBateau ; protected String categorie ; protected static int numid=0; protected String classeBateau ; }
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
72
73
74
75
76
77
78
79
80
81
82 package com.example.alexa.marieteam; import android.os.Bundle; public class BateauVoyageur extends Bateau { protected int vitesseBateauVoyageur ; protected int nbPassager ; public BateauVoyageur(String nom ,int nbPassager , int categorie, int vitesse ,int laHauteur , int laLargeur )throws Exception { super(nom,laLargeur,laHauteur); this.id_Bateau=numid ; this.nom=nom ; this.nbPassager=nbPassager; this.vitesseBateauVoyageur=vitesse ; this.hauteurBateau=laHauteur ; this.largeurBateau=laLargeur ; this.classeBateau="voyageur"; if(categorie>0 && categorie<4){ if(categorie==1){ this.categorie="Passager"; } else if(categorie==2){ this.categorie="Vehicule inférieur à 2 metres"; } else if (categorie==3){ this.categorie="vehicule superieur à 2 mètre "; } } numid=numid+1; } public int getNbPassager(){ return this.nbPassager ; } public void setNbpassager(int nbpassager){ this.nbPassager=nbpassager ; } public String getCategorie(){ return this.categorie ; } public void setCategorie(String lacategorie){ this.categorie=lacategorie ; } public int getVitesseBateauVoyageur(){ return this.vitesseBateauVoyageur ; } public void setVitesseBateauVoyageur(int vitesseBateauVoyageur){ this.vitesseBateauVoyageur=vitesseBateauVoyageur ; } public int getlargeurBateau(){ return this.largeurBateau; } public void setlargeurbateau(int lageurbateau ) { this.largeurBateau=lageurbateau; } public int gethauteur(){ return this.hauteurBateau; } public void sethauteurBateau(int hauteurbateau){ this.hauteurBateau=hauteurbateau; } public String getclasseBateau(){ return this.classeBateau ; } }
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 package com.example.alexa.marieteam; import java.util.ArrayList; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class BateauBDD { public static final int VERSION = 1; public static final String NOM_BDD = "bateau.db"; public static final String TABLE_BATEAU = "table_Bateau"; public static final String COL_ID = "ID"; public static final String COL_NAME = "nom"; public static final String VISTESSE_BATEAU_VOYAGEUR = "vitesse_Bateau_Voyageur"; public static final String NBPLACEPASSAGER = "nb_Place_Passager"; public static final String CATEGORIE ="categorie"; public static final String POIDS_BATEAU_FRET="Poids_Max_BateauFret"; public static final String CLASSEBATEAU="classe_bateau"; private SQLiteDatabase bdd; private BateauBaseSQLite bateaux ; public BateauBDD(Context context) { bateaux = new BateauBaseSQLite(context, NOM_BDD, null, VERSION); } public BateauBDD open(){ try { this.bdd = this.bateaux.getWritableDatabase(); } catch(Exception e){ System.out.println("L ERREUR DE LA BDD EST "+ e.getMessage()); } return this; } public BateauBDD close(){ this.bdd.close(); return null ; } public SQLiteDatabase getBdd() { return bdd; } public long insertBateau(Bateau bateau ){ ContentValues content = null; if (bateau.getclasseBateau()== "voyageur") { bateau = (BateauVoyageur) bateau; content = new ContentValues(); content.put(COL_ID, bateau.getId()); content.put(COL_NAME, ((BateauVoyageur) bateau).getNom()); content.put(VISTESSE_BATEAU_VOYAGEUR, ((BateauVoyageur) bateau).getVitesseBateauVoyageur()); content.put(NBPLACEPASSAGER, ((BateauVoyageur) bateau).getNbPassager()); content.put(CATEGORIE, ((BateauVoyageur) bateau).getCategorie()); content.put(CLASSEBATEAU, ((BateauVoyageur) bateau).getclasseBateau()); } else if(bateau.getclasseBateau() == "fret") { bateau = (Bateau_fret) bateau; content = new ContentValues(); content.put(COL_ID, bateau.getId()); content.put(COL_NAME, bateau.getNom()); content.put(POIDS_BATEAU_FRET, ((Bateau_fret) bateau).getPoids_Bateau_Fret()); content.put(CLASSEBATEAU, ((Bateau_fret) bateau).getclasseBateau()); } return bdd.insert(TABLE_BATEAU, null, content); } public int updateBateau(int id,Bateau unBateau) { ContentValues content=null ; if (unBateau.getclasseBateau()== "voyageur") { unBateau = (BateauVoyageur) unBateau; content = new ContentValues(); content.put(COL_NAME, unBateau.getNom()); content.put(VISTESSE_BATEAU_VOYAGEUR, ((BateauVoyageur) unBateau).getVitesseBateauVoyageur()); content.put(NBPLACEPASSAGER, ((BateauVoyageur) unBateau).getNbPassager()); content.put(CATEGORIE, ((BateauVoyageur) unBateau).getCategorie()); content.put(CLASSEBATEAU, unBateau.getclasseBateau()); } else if (unBateau.getclasseBateau() == "fret") { unBateau =(Bateau_fret) unBateau; content = new ContentValues(); content.put(COL_ID,unBateau.getId()); content.put(COL_NAME, unBateau.getNom()); content.put(POIDS_BATEAU_FRET,((Bateau_fret) unBateau).getPoids_Bateau_Fret()); content.put(CLASSEBATEAU ,((Bateau_fret)unBateau).getclasseBateau()); } return bdd.update(TABLE_BATEAU,content,COL_ID+"="+id, null); } public int removeBateau(String name) { return bdd.delete(TABLE_BATEAU, COL_NAME + " = " + name, null); } public Cursor getAllBateau(){ return bdd.rawQuery("SELECT * FROM "+TABLE_BATEAU,null); } }
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 package com.example.alexa.marieteam; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; public class BateauBaseSQLite extends SQLiteOpenHelper { private static final String TABLE_BATEAU = "table_Bateau"; private static final String COL_ID = "ID"; private static final String COL_NAME = "nom"; private static final String VISTESSE_BATEAU_VOYAGEUR = "vitesse_Bateau_Voyageur"; private static final String NBPLACEPASSAGER = "nb_Place_Passager"; private static final String CATEGORIE ="categorie"; private static final String POIDS_BATEAU_FRET="Poids_Max_BateauFret"; private static final String CLASSEBATEAU="classe_bateau"; private static final String CREATE_BDD_BATEAU = "CREATE TABLE " + TABLE_BATEAU + " (" + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_NAME + " TEXT NOT NULL, " + VISTESSE_BATEAU_VOYAGEUR+ " INTEGER ," + NBPLACEPASSAGER+" INTEGER, "+CATEGORIE+" TEXT NOT NULL ,"+POIDS_BATEAU_FRET+" INT, "+CLASSEBATEAU+" TEXT NOT NULL); "; public BateauBaseSQLite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) { super(context, name, factory, version); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_BDD_BATEAU); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE " + TABLE_BATEAU); onCreate(db); } }
Partager