bounjour a tous
s'il vous plait est ce que quelqu'un peut m'aider
je veux créer une application qui permet qui liste un ensemble des examen (chaque examen est ensemble de question sous forme QCM)
j'ai deja créer mon base de données (avec sqlite database browser) qui contient 5 tables
la table candidat qui contient tous les informations d'un candidat veux passer un examen
-la table Examen qui liste tous les examen
-la table Question qui liste tous les question d'un examen
-la table Réponse qui liste tous les réponse pour chaque question
-la table Résultat-examen liste les examen passées par un candidat dans une date bien déterminé
-la table Résultat_réponse contient tous les réponses sélectionnés par un candidat d'un examen
j'ai ensuite créer les classes java suivantes
-Question.java
-Examen.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
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 package com.android.adapter; import java.util.ArrayList; public class Question { private int idexam,numq; private String question; private ArrayList<Reponse> reponse; public Question() { super(); } public Question(int idexam, int numq, String question, ArrayList<Reponse> reponse) { super(); this.idexam = idexam; this.numq = numq; this.question = question; this.reponse = reponse; } public int getIdexam() { return idexam; } public void setIdexam(int idexam) { this.idexam = idexam; } public int getNumq() { return numq; } public void setNumq(int numq) { this.numq = numq; } public String getQuestion() { return question; } public void setQuestion(String question) { this.question = question; } public ArrayList<Reponse> getReponse() { return reponse; } public void setReponse(ArrayList<Reponse> reponse) { this.reponse = reponse; } @Override public String toString() { return "Question [idexam=" + idexam + ", numq=" + numq + ", question=" + question + ", reponse=" + reponse + "]"; } }
-Reponse.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
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 package com.android.adapter; import java.util.ArrayList; public class Examen { private int idexam; private String nom; private int nbrq; //nombre de question private int duree; //la durée pour passer un examen private ArrayList<Question> question; public int getIdexam() { return idexam; } public void setIdexam(int idexam) { this.idexam = idexam; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public int getNbrq() { return nbrq; } public void setNbrq(int nbrq) { this.nbrq = nbrq; } public int getDuree() { return duree; } public void setDuree(int duree) { this.duree = duree; } public ArrayList<Question> getQuestion() { return question; } public void setQuestion(ArrayList<Question> question) { this.question = question; } public Examen(int idexam, String nom, int nbrq, int duree, ArrayList<Question> question) { super(); this.idexam = idexam; this.nom = nom; this.nbrq = nbrq; this.duree = duree; this.question = question; } }
-candidat.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
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 package com.android.adapter; public class Reponse { private int numrep,numques,idexam; private String reponse; private boolean correct; private float point; public Reponse() { super(); } public Reponse(int numrep, int numques, int idexam, String reponse, boolean correct, float point) { super(); this.numrep = numrep; this.numques = numques; this.idexam = idexam; this.reponse = reponse; this.correct = correct; this.point = point; } public int getNumrep() { return numrep; } public void setNumrep(int numrep) { this.numrep = numrep; } public int getNumques() { return numques; } public void setNumques(int numques) { this.numques = numques; } public int getIdexam() { return idexam; } public void setIdexam(int idexam) { this.idexam = idexam; } public String getReponse() { return reponse; } public void setReponse(String reponse) { this.reponse = reponse; } public boolean isCorrect() { return correct; } public void setCorrect(boolean correct) { this.correct = correct; } public float getPoint() { return point; } public void setPoint(float point) { this.point = point; } @Override public String toString() { return "Reponse [numrep=" + numrep + ", numques=" + numques + ", idexam=" + idexam + ", reponse=" + reponse + ", correct=" + correct + ", point=" + point + "]"; } }
j'ai aussi créer deux activity pour faire un test
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 package com.android.adapter; public class Candidat { private String nom,prenom; private int idpers; public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public String getPrenom() { return prenom; } public void setPrenom(String prenom) { this.prenom = prenom; } public int getIdpers() { return idpers; } public void setIdpers(int idpers) { this.idpers = idpers; } public Candidat(String nom, String prenom, int idpers) { super(); this.nom = nom; this.prenom = prenom; this.idpers = idpers; } }
-l'une contient un bouton (passer examen)
-l'autre contient un textview et trois radio bouton et deux bouton
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 package com.android.application; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { /** Called when the activity is first created. */ private Button bt; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); bt=(Button)findViewById(R.id.button1); bt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent( MainActivity.this, QuestionActivity.class ); startActivity(intent); // We put the language setup in this intent //intent.putExtra( "lang", ACTIVITY_SURVEY_FR ); // We launch a new activity //startActivityForResult( intent, ACTIVITY_SURVEY_FR ); } }); } /* protected void onActivityResult( int requestCode, int resultCode, Intent intent ) { super.onActivityResult( requestCode, resultCode, intent ); // We get the bundle from the Survey activity Bundle extras = intent.getExtras(); switch( requestCode ) { case : case : mNbSamples = extras.getInt( "nbSamples" ); mNbSamplesDisplay.setText( Integer.toString( mNbSamples ) ); break; default: // We do nothing break; } }*/ }
jusqu'a ici je me suis bloquée
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 package com.android.application; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; public class QuestionActivity extends Activity{ public RadioButton rb1,rb2,rb3; private RadioGroup rg; private TextView tv; private Button b1,b2; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.question); } }
je ne sais rien a faire
comment faire récupérer les données de mes tables pour qu’ils soient afficher
dans mon émulateur?
vraiment je suis bloquées je sais pas par quoi je peut commencer
s'il vous plait si quelqu'un peut m'aider
Partager