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

Composants graphiques Android Discussion :

Problème d'affichage dans un ListView


Sujet :

Composants graphiques Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Novembre 2014
    Messages : 24
    Par défaut Problème d'affichage dans un ListView
    Salut à tous. SVP j'ai un problème. Je ne sais pas pourquoi mon avd n'affiche pas les données dans un ListView. Il ouvre l'appli mais la referme instantanément. Voici le code de ma méthode onCreate. quelqu'un peux m'aider?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    String[] tableau = new String[]{
            	    "Un" ,"Deux" ,"Trois" ,"Quatre"
            	   ,"Cinq" ,"Six" ,"Sept" ,"Huit"
            	   ,"Neuf" ,"Dix"};
            	ArrayAdapter<String> adapter =
            	new ArrayAdapter<String>(
            	   this
            	   ,android.R.layout.simple_list_item_1, tableau);
            	this.setListAdapter(adapter);

  2. #2
    Modérateur
    Avatar de MasterMbg
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Octobre 2011
    Messages
    719
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Congo-Kinshasa

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 719
    Par défaut
    Bonsoir,

    Si l'application ferme subitement elle doit t'envoyer sûrement des messages dan le logcat. Sans ce message on ne saura pas deviner l'erreur. En plus, le bout de code que t'as posté n'aide pas vraiment.

    Christian,
    Plus tu apprends sérieusement, plus tu te rapproches d'un savoir noble. Une chose est certaine, les difficultés ne s'écarteront de ton chemin...

    Tu es nouveau dans le développement Android, la page des COURS est là pour te faciliter la vie
    Tu peux trouver la réponse à ta question dans la FAQ
    Retrouvez mon tutoriel sur la consommation des services web SOAP
    Pense à voter positivement en appuyant sur en bas à droite de la réponse qui t'a donné une piste de solution.

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Novembre 2014
    Messages : 24
    Par défaut problème avec l'environnement de developpement
    Bonsoir, Le problème qui se pose c'est que mon emulateur ne fonctionne pas correctement. J'utilise plutot bluestack pour executer mes applis. Svp, pouvez vous d'abord m'aider a régler ce problème? Quand j'exécute une application, l'émulateur prend beaucoup de temps pour s'ouvrir et quand il s'ouvre, l'application n'y est pas installé.
    Merci

  4. #4
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Novembre 2014
    Messages : 24
    Par défaut problème d'affichage dans un ListView
    Bonsoir a tous,
    J'ai deja resolu le problème de mon environnement. Voici ce que j'ai dans le Logcat quand je lance mon pappli.

    10-15 17:00:17.900: D/AndroidRuntime(6483): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
    10-15 17:00:17.900: D/AndroidRuntime(6483): CheckJNI is OFF
    10-15 17:00:18.250: I/ethernet(6483): Loading ethernet jni class
    10-15 17:00:18.300: D/AndroidRuntime(6483): Calling main entry com.android.commands.pm.Pm
    10-15 17:00:18.320: D/AndroidRuntime(6483): Shutting down VM
    10-15 17:00:18.320: D/dalvikvm(6483): GC_CONCURRENT freed 99K, 83% free 456K/2560K, paused 0ms+0ms
    10-15 17:00:18.330: D/dalvikvm(6483): Debugger has detached; object registry had 1 entries
    10-15 17:00:18.720: D/AndroidRuntime(6496): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
    10-15 17:00:18.720: D/AndroidRuntime(6496): CheckJNI is OFF
    10-15 17:00:18.950: I/ethernet(6496): Loading ethernet jni class
    10-15 17:00:19.040: D/AndroidRuntime(6496): Calling main entry com.android.commands.am.Am
    10-15 17:00:19.050: I/ActivityManager(1166): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.sesomatre.adapter1/.MainActivity} from pid 6496
    10-15 17:00:19.070: D/ActivityManager(1166): TopActivityInfo, pkgName: com.sesomatre.adapter1 activityName: com.sesomatre.adapter1.MainActivity bstSpecialAppKeyboardHandlingEnabled = false
    10-15 17:00:19.070: D/ActivityManager(1166): Showing guidance for pkgName: com.sesomatre.adapter1
    10-15 17:00:19.100: D/GuidanceScreen(1319): hiding guidance
    10-15 17:00:19.100: D/GuidanceScreen(1319): hardKeyboard = 1
    10-15 17:00:19.100: D/GuidanceScreen(1319): event: app_launch
    10-15 17:00:19.100: D/GuidanceScreen(1319): topPkg: com.sesomatre.adapter1
    10-15 17:00:19.100: D/GuidanceScreen(1319): currentPkg: com.sesomatre.adapter1
    10-15 17:00:19.100: D/GuidanceScreen(1319): appName: Adapter1
    10-15 17:00:19.500: W/System.err(1166): Error: /data/data/libqemu_wl.user.txt: open failed: ENOENT (No such file or directory)
    10-15 17:00:19.500: D/GuidanceScreen(1319): no guidance for com.sesomatre.adapter1
    10-15 17:00:19.500: D/GuidanceScreen(1319): mControllerAttached = false
    10-15 17:00:19.500: D/GuidanceScreen(1319): mControllerType = DualAction
    10-15 17:00:19.500: D/GuidanceScreen(1319): mControllerType = DualAction
    10-15 17:00:19.500: D/GuidanceScreen(1319): EventType = app_launch
    10-15 17:00:19.500: I/ActivityManager(1166): package `com.sesomatre.adapter1` whitelisting status = false
    10-15 17:00:19.520: D/dalvikvm(6506): Late-enabling CheckJNI
    10-15 17:00:19.520: I/ActivityManager(1166): Start proc com.sesomatre.adapter1 for activity com.sesomatre.adapter1/.MainActivity: pid=6506 uid=10054 gids={}
    10-15 17:00:19.570: D/AndroidRuntime(6496): Shutting down VM
    10-15 17:00:19.570: D/dalvikvm(6496): GC_CONCURRENT freed 100K, 82% free 477K/2560K, paused 0ms+0ms
    10-15 17:00:19.730: D/dalvikvm(6496): Debugger has detached; object registry had 1 entries
    10-15 17:00:19.810: I/AndroidRuntime(6496): NOTE: attach of thread 'Binder Thread #3' failed
    10-15 17:00:20.100: D/AndroidRuntime(6506): Shutting down VM
    10-15 17:00:20.100: W/dalvikvm(6506): threadid=1: thread exiting with uncaught exception (group=0xb2c80180)
    10-15 17:00:20.120: D/AndroidRuntime(6506): procName from cmdline: com.sesomatre.adapter1
    10-15 17:00:20.120: E/AndroidRuntime(6506): in writeCrashedAppName, pkgName :com.sesomatre.adapter1
    10-15 17:00:20.130: D/AndroidRuntime(6506): file written successfully with content: com.sesomatre.adapter1 StringBuffer : ;com.sesomatre.adapter1
    10-15 17:00:20.140: D/BstCommandProcessor-Application(1346): Application crash has been observed.
    10-15 17:00:20.140: I/Process(6506): Sending signal. PID: 6506 SIG: 9
    10-15 17:00:20.140: E/AndroidRuntime(6506): FATAL EXCEPTION: main
    10-15 17:00:20.140: E/AndroidRuntime(6506): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sesomatre.adapter1/com.sesomatre.adapter1.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.ActivityThread.access$600(ActivityThread.java:123)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.os.Handler.dispatchMessage(Handler.java:99)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.os.Looper.loop(Looper.java:137)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.ActivityThread.main(ActivityThread.java:4424)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at java.lang.reflect.Method.invokeNative(Native Method)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at java.lang.reflect.Method.invoke(Method.java:511)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at dalvik.system.NativeStart.main(Native Method)
    10-15 17:00:20.140: E/AndroidRuntime(6506): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.ListActivity.onContentChanged(ListActivity.java:243)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:254)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.Activity.setContentView(Activity.java:1835)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at com.sesomatre.adapter1.MainActivity.onCreate(MainActivity.java:13)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.Activity.performCreate(Activity.java:4465)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1051)
    10-15 17:00:20.140: E/AndroidRuntime(6506): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
    10-15 17:00:20.140: E/AndroidRuntime(6506): ... 11 more
    10-15 17:00:20.170: I/ActivityManager(1166): Process com.sesomatre.adapter1 (pid 6506) has died.
    10-15 17:00:20.170: W/ActivityManager(1166): Force removing ActivityRecord{b32d4ba0 com.sesomatre.adapter1/.MainActivity}: app died, no saved state
    10-15 17:00:20.170: D/ActivityManager(1166): TopActivityInfo, pkgName: com.bluestacks.gamepophome activityName: com.bluestacks.gamepophome/tv.gamepop.home.AllAppsFullGrid_ bstSpecialAppKeyboardHandlingEnabled = false
    10-15 17:00:20.170: D/ActivityManager(1166): Showing guidance for pkgName: com.bluestacks.gamepophome
    10-15 17:00:20.190: D/GuidanceScreen(1319): hiding guidance
    10-15 17:00:20.190: D/GuidanceScreen(1319): hardKeyboard = 1
    10-15 17:00:20.190: D/GuidanceScreen(1319): event: app_launch
    10-15 17:00:20.190: D/GuidanceScreen(1319): topPkg: com.bluestacks.gamepophome
    10-15 17:00:20.190: D/GuidanceScreen(1319): currentPkg: com.bluestacks.gamepophome
    10-15 17:00:20.190: D/GuidanceScreen(1319): appName: Gamepop-Home
    10-15 17:00:20.300: W/InputManagerService(1166): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b32e7ac8
    10-15 17:00:20.310: D/GuidanceScreen(1319): no guidance for com.bluestacks.gamepophome
    10-15 17:00:20.310: D/GuidanceScreen(1319): mControllerAttached = false
    10-15 17:00:20.310: D/GuidanceScreen(1319): mControllerType = DualAction
    10-15 17:00:20.310: D/GuidanceScreen(1319): mControllerType = DualAction
    10-15 17:00:20.310: D/GuidanceScreen(1319): EventType = app_launch

  5. #5
    Membre chevronné
    Profil pro
    Inscrit en
    Juillet 2012
    Messages
    476
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2012
    Messages : 476
    Par défaut
    Problème courant des utilisateurs des ListActivity débutants

    10-15 17:00:20.140: E/AndroidRuntime(6506): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sesomatre.adapter1/com.sesomatre.adapter1.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
    Ca veut dire que ton layout est mauvais. L'id de ta listview doit être "@android:id/list", comme indiqué dans les références http://developer.android.com/referen...tActivity.html

  6. #6
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Novembre 2014
    Messages : 24
    Par défaut
    Cool Turvy. Ca marche super bien.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème d'affichage dans une ListView
    Par tabbabi dans le forum Composants graphiques
    Réponses: 2
    Dernier message: 10/08/2011, 12h58
  2. Problème d'affichage dans un tableau
    Par claralavraie dans le forum ASP
    Réponses: 13
    Dernier message: 21/12/2005, 15h45
  3. [JSTL] Problème d'affichage dans un <c:forEach>
    Par zwck dans le forum Taglibs
    Réponses: 6
    Dernier message: 05/11/2005, 21h35
  4. Problème d'affichage dans un composant TScrollBox
    Par erossi dans le forum Composants VCL
    Réponses: 3
    Dernier message: 14/09/2005, 11h29
  5. [débutant]problèmes d'affichage dans un tableau
    Par Hastur dans le forum Balisage (X)HTML et validation W3C
    Réponses: 12
    Dernier message: 16/08/2005, 12h00

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