IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

arret brutal de l'application


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Lycéen
    Inscrit en
    Février 2013
    Messages
    63
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2013
    Messages : 63
    Par défaut arret brutal de l'application
    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);
        }
     
    }

  2. #2
    Expert confirmé

    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Février 2007
    Messages
    4 253
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2007
    Messages : 4 253
    Billets dans le blog
    3
    Par défaut
    Comme tu l'as écrit:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Caused by: java.lang.IllegalArgumentException: column '_id' does not exist
    Un petit tour dans la doc de SimpleCursorAdapter (et surtout de son parent: CursorAdapter) confirme que:
    The Cursor must include a column named "_id" or this class will not work
    PS. Rien n'empêche de renommer les colonnes lors de la query ! (genre select id as _id .... )

  3. #3
    Membre confirmé
    Homme Profil pro
    Lycéen
    Inscrit en
    Février 2013
    Messages
    63
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2013
    Messages : 63
    Par défaut
    ok merci je vais essayer

Discussions similaires

  1. [PC fixe] mon pc s' arrete brutalement
    Par daniouze dans le forum Ordinateurs
    Réponses: 6
    Dernier message: 22/01/2012, 11h43
  2. Message lors de la fermeture brutale d'une application
    Par Asdorve dans le forum VB 6 et antérieur
    Réponses: 5
    Dernier message: 06/09/2010, 09h50
  3. Arret brutal après execution de tous les programmes
    Par guismoman33 dans le forum Windows XP
    Réponses: 1
    Dernier message: 15/09/2009, 19h45
  4. [débutant] arret brutal du programme
    Par ~Brouette~ dans le forum C
    Réponses: 16
    Dernier message: 16/11/2006, 17h12
  5. [tomcat 559] [unix] arret et demarrage d'application
    Par noOneIsInnocent dans le forum Tomcat et TomEE
    Réponses: 3
    Dernier message: 16/10/2006, 17h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo