Bonjour à tous!

Je vous explique mon problème. Alors pour mon projet de cours d'année je dois manipuler des bases de données SQLIite, donc pour cela je crée une petite application en m'inspirant d'un tuto : (http://a-renouard.developpez.com/tut...ndroid/sqlite/) que j'adapte à mon projet (je reste dans quelque chose de basique). Seulement quand je copie colle le tuto sous android studio et que je lance l'application cela fonctionne. Mais mon application ne s'ouvre pas.
Voila le message sur mon smartphone : " L'application s'est arrêté " . Quelqu'un pour y jeter un coup d’œil, je commence à désespérer .


Class Exercice (Livre)
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
package com.example.jassimaanaoui.bddtest;
/**
 * Created by jassim.aanaoui on 08/02/2018.
 */
public class Exercice {

    private int id;
    private String login;
    private int force_avant;
    private int force_arriere;

    public Exercice () {}

    public Exercice (String login, int force_avant, int force_arriere) {
        this.login = login ;
        this.force_avant = force_avant;
        this.force_arriere = force_arriere;
    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public int getForce_avant() {
        return force_avant;
    }

    public void setForce_avant(int force_avant){
        this.force_avant = force_avant;
    }

    public int getForce_arriere() {
        return force_arriere;
    }

    public void setForce_arriere(int force_arriere){
        this.force_arriere = force_arriere;
    }

    public String toString (){
        return "Login :" +login + "\nforce avant : " + force_avant + "\nforce arriere : "
+force_arriere;
    }

    public static class ExerciceBDD {
    }
}
Class ExerciceBDD (LivreBDD)


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
120
121
122
123
package com.example.jassimaanaoui.bddtest;


/**
 * Created by jassim.aanaoui on 12/02/2018.
 */
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;


public class ExerciceBDD  {


    private static  final int VERSION_BDD = 1;
    private static  final String NOM_BDD = "Sportif.db";


    private static final String TABLE_EXERCICE = "table_exercice";
    private static final String COL_ID = "ID";
    private static final int NUM_COL_ID = 0;
    private static final String COL_LOGIN = "Login";
    private static final int NUM_COL_LOGIN = 1;
    private static final String COL_FORCEAV = "ForceAvant";
    private static final int NUM_COL_FORCEAV = 2;
    private static final String COL_FORCEAR = "ForceArriere";
    private static final int NUM_COL_FORCEAR = 3;

    private SQLiteDatabase bdd;

    private DataManager dataManager;





    public ExerciceBDD(Context context ) {



        //On crée la BDD et sa table
dataManager = new DataManager(context, NOM_BDD, null, VERSION_BDD);

    }

    public void open(){

        //on ouvre la BDD en écriture
bdd = dataManager.getWritableDatabase();
    }

    public void close(){
        //on ferme l'accès à la BDD
bdd.close();
    }

    public SQLiteDatabase getBDD() {
        return bdd;
    }

    public long insertExercice(Exercice exercice){
        //Création d'un ContentValues (fonctionne comme une HashMap)
ContentValues values = new ContentValues();
        //on lui ajoute une valeur associée à une clé (qui est le nom de la colonne dans laquelle on veut mettre la valeur)
values.put(COL_LOGIN, exercice.getLogin());
        values.put(COL_FORCEAV, exercice.getForce_avant());
        values.put(COL_FORCEAR, exercice.getForce_arriere());
        //on insère l'objet dans la BDD via le ContentValues
return bdd.insert(TABLE_EXERCICE, null, values);
    }

    public int updateExercice(int id, Exercice exercice){
        //La mise à jour d'un livre dans la BDD fonctionne plus ou moins comme une insertion
        //il faut simplement préciser quel livre on doit mettre à jour grâce à l'ID
ContentValues values = new ContentValues();
        values.put(COL_LOGIN, exercice.getLogin());
        values.put(COL_FORCEAV, exercice.getForce_avant());
        values.put(COL_FORCEAR, exercice.getForce_arriere());

        return bdd.update(TABLE_EXERCICE, values, COL_ID + " = " +id, null);
    }

    public int removeExerciceWithID(int id){
        //Suppression d'un livre de la BDD grâce à l'ID
return bdd.delete(TABLE_EXERCICE, COL_ID + " = " +id, null);
    }




    public Exercice getExerciceWithLogin(String login){
        //Récupère dans un Cursor les valeurs correspondant à un exercice contenu dans la BDD (ici on sélectionne le l'exercice grâce au login)
Cursor c = bdd.query(TABLE_EXERCICE, new String[] {COL_ID, COL_LOGIN, COL_FORCEAV, COL_FORCEAR}, COL_LOGIN + " LIKE \"" + login +"\"", null, null, null, null);
        return cursorToExercice(c);
    }

        //Cette méthode permet de convertir un cursor en un exercice
private Exercice cursorToExercice(Cursor c) {

        //si aucun élément n'a été retourné dans la requête, on renvoie null
if (c.getCount() == 0)
            return null;

        //Sinon on se place sur le premier élément
c.moveToFirst();
        //On créé un exercice
Exercice exercice = new Exercice();
        //on lui affecte toutes les infos grâce aux infos contenues dans le Cursor
exercice.setId(c.getInt(NUM_COL_ID));
        exercice.setLogin(c.getString(NUM_COL_LOGIN));
        exercice.setForce_avant(c.getInt(NUM_COL_FORCEAV));
        exercice.setForce_arriere(c.getInt(NUM_COL_FORCEAR));
        //On ferme le cursor
c.close();

        //On retourne l'exercice
return exercice;
    }
}
Class DataManage (MaBaseSQLite)
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
package com.example.jassimaanaoui.bddtest;

/**
 * Created by jassim.aanaoui on 08/02/2018.
 */
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;


public class DataManager extends SQLiteOpenHelper {

    private static final String TABLE_EXERCICE = "table_exercice";
    private static final String COL_ID = "ID";
    private static final String COL_LOGIN = "login";
    private static final String COL_FORCE_AVANT ="force_avant";
    private static final String COL_FORCE_ARRIERE="force_arriere";


    private static final String CREATE_BDD = "CREATE TABLE " + TABLE_EXERCICE + " ("
+ COL_ID + "INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_LOGIN + " TEXT, " + COL_FORCE_AVANT  +" NUMBER, "
+ COL_FORCE_ARRIERE+ " NUMBER);";

    public DataManager( Context context,  String name, CursorFactory factory, int version ){
        super(context, name, factory, version);

    }

    @Override
public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_BDD);


    }

    @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        db.execSQL(" DROP TABLE " + TABLE_EXERCICE + ";");
        onCreate(db);

    }
}
Cordialement.