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 :

Problème variable globale


Sujet :

Android

  1. #21
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2014
    Messages
    50
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 50
    Par défaut
    Citation Envoyé par mimir02 Voir le message
    mon textview est bien mon layout je crois?
    Il doit être dans ton layout si jamais tu l'as rajouté.
    Mais de toute façon tu as commenté la ligne setContentView() !!

    Tu as maintenant deux solution possibles:
    1- supprimer le textView au cas où tu n'as pas un layout (ou bien ce n'est pas important pour toi d'en avoir au moins pour cet exemple)
    2- remmettre le setContentView(R.layout.main); au cas où tu as un layout ou bien tu vas faire un. ex:
    setContentView(R.layout.main);
    textView txtView = (TextView) findViewById(R.id.ResultTextView); // à condition que l'id de ton TextView est bien ResultTextView
    task = new TheTask(this, txtView)

    de l'autre côté dans TheTaskClass le constructeur sera le suivant:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
       public TheTask(MainActivity a, TextView t){
    	activity = a;
            textView = t;
        }

  2. #22
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    Ca ne marche tout de meme pas et laisse les memes erreurs:
    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
    package com.example.basedonnees;
     
     
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.util.ArrayList;
     
     
    //import org.apache.http.NameValuePair;
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;
     
    import android.app.ListActivity;
    import android.net.ParseException;
    import android.os.Bundle;
    import android.util.Log;
    import android.widget.ArrayAdapter;
    import android.widget.TextView;
    import android.widget.Toast;
     
     
    public class MainActivity extends ListActivity {
        /** Called when the activity is first created. */
        InputStream isMain = null;
        TheTask task;
        String probleme= null;
      //setContentView(R.layout.main);
        String result = null;
     JSONObject json_data=null;
     //ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
     ArrayList<String> donnees = new ArrayList<String>();
     TextView textView = new TextView(this);
     
     
     
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
     
         try{
     
     
         //commandes httpClient
     
            task= new TheTask(this);
     
            task.execute("http://192.168.15.117/ecoles/projet.php");
     
     
         }
         catch(Exception e){
        	 	Log.i("taghttppost",""+e.toString());
     
     
                Toast.makeText(getBaseContext(),e.toString() ,Toast.LENGTH_LONG).show();
           }
        }   
         public void handleResult(InputStream is){
         	isMain=is;
     
     
         	textView.setText("Server message is "+result);
     
     
          //conversion de la réponse en chaine de caractère
             try
             {
              BufferedReader reader = new BufferedReader(new InputStreamReader(isMain,"UTF-8"));
     
              StringBuilder sb  = new StringBuilder();
     
              String line = null;
     
              while ((line = reader.readLine()) != null) 
              {
              sb.append(line + "\n");
              }
     
              isMain.close();
     
              result = sb.toString();
     
             }
             catch(Exception e)
             {
              Log.e("tagconvertstr",""+e.toString());
             }
             //recuperation des donnees json
             try{
               JSONArray jArray = new JSONArray(result);
     
                  for(int i=0;i<jArray.length();i++)
                  {
     
                        json_data = jArray.getJSONObject(i);
                        donnees.add(json_data.getString("nom"));
                        //r.add(json_data.getString("categorie"));
     
                    }
                     setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, donnees));
                 }
                 catch(JSONException e){
                  Log.e("tagjsonexp",""+e.toString());
                 } catch (ParseException e) {
                  Log.e("tagjsonpars",""+e.toString());
            }
         }
     }
    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
    package com.example.basedonnees;
     
    import java.io.InputStream;
    import java.util.ArrayList;
     
     
     
    import org.apache.http.HttpEntity;
    import org.apache.http.HttpResponse;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.util.EntityUtils;
     
     
     
    import android.os.AsyncTask;
    import android.util.Log;
    import android.widget.TextView;
     
    public class TheTask extends AsyncTask<String,String,String>
        {
    	private TextView textView;
    	public InputStream is;
    	public String entityStr;
    	MainActivity activity;
     
    public TheTask(MainActivity a){
    	activity = a;
    }
     
    protected void onPostExecute(String result) {
        // TODO Auto-generated method stub
        super.onPostExecute(result);
        // update textview here
        textView.setText("Server message is "+result);
        activity.handleResult(is);
    }
     
    @Override
    protected void onPreExecute() {
        // TODO Auto-generated method stub
        super.onPreExecute();
    }
     
     
    @Override
    protected String doInBackground(String... params) {
    	ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
         try
            {
                HttpClient httpclient = new DefaultHttpClient();
                HttpPost method = new HttpPost(params[0]);
                method.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                HttpResponse response = httpclient.execute(method);
                HttpEntity entity = response.getEntity();
     
     
                if(entity != null){
                	entityStr=EntityUtils.toString(entity);
     
                	HttpClient httpclient2 = new DefaultHttpClient();
                	HttpPost method2 = new HttpPost(params[0]);
                    method2.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response2 = httpclient2.execute(method2);
                    HttpEntity entity2 = response2.getEntity();
     
                	is = entity2.getContent();
     
                    return entityStr;
                }
                else{
                    entityStr="No string.";
                    return entityStr;
                }
             }
             catch(Exception e){
            	 Log.i("entity=",e.toString());
                 entityStr="Network problem";
                 return entityStr;
             }
     
     
    }
    }
    05-30 10:30:17.940: D/AndroidRuntime(1150): Shutting down VM
    05-30 10:30:17.940: W/dalvikvm(1150): threadid=1: thread exiting with uncaught exception (group=0xb4aeaba8)
    05-30 10:30:17.990: E/AndroidRuntime(1150): FATAL EXCEPTION: main
    05-30 10:30:17.990: E/AndroidRuntime(1150): Process: com.example.basedonnees, PID: 1150
    05-30 10:30:17.990: E/AndroidRuntime(1150): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.basedonnees/com.example.basedonnees.MainActivity}: java.lang.NullPointerException
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.app.ActivityThread.access$800(ActivityThread.java:135)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.os.Handler.dispatchMessage(Handler.java:102)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.os.Looper.loop(Looper.java:136)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.app.ActivityThread.main(ActivityThread.java:5017)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at java.lang.reflect.Method.invokeNative(Native Method)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at java.lang.reflect.Method.invoke(Method.java:515)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at dalvik.system.NativeStart.main(Native Method)
    05-30 10:30:17.990: E/AndroidRuntime(1150): Caused by: java.lang.NullPointerException
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.content.ContextWrapper.getResources(ContextWrapper.java:89)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:78)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.view.View.<init>(View.java:3438)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.view.View.<init>(View.java:3505)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.widget.TextView.<init>(TextView.java:623)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.widget.TextView.<init>(TextView.java:618)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.widget.TextView.<init>(TextView.java:614)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at com.example.basedonnees.MainActivity.<init>(MainActivity.java:34)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at java.lang.Class.newInstanceImpl(Native Method)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at java.lang.Class.newInstance(Class.java:1208)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
    05-30 10:30:17.990: E/AndroidRuntime(1150): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
    05-30 10:30:17.990: E/AndroidRuntime(1150): ... 11 more

  3. #23
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    Donc si j'en ai deja un je fais que: remmettre le setContentView(R.layout.main);?

  4. #24
    Rédacteur
    Avatar de David55
    Homme Profil pro
    Ingénieur informatique
    Inscrit en
    Août 2010
    Messages
    1 542
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2010
    Messages : 1 542
    Par défaut
    Bonjour tu as un problème à la ligne 34 de ton fichier:
    (MainActivity.java:34)
    Tu as un soucis d'instanciation. Il te manque un xml (setContentView). Ainsi, tu pourras récupérer ton TextView pour afficher quelque chose dedans.

    N'hésites pas à indenter ton code pour qu'on y voit plus clair car comme cela c'est le fouillis.

  5. #25
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    comment connaitre l'id du textview?

  6. #26
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2014
    Messages
    50
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 50
    Par défaut
    Il me semble que tu ne fais pas assez d'effort

    le TextView textView = new TextView(this); est faux car tu essaies d'instantier un textView en lui passant une activité qui n'est pas encore construite.
    Si tu insistes à avoir un textView mets cette ligne dans onCreate() et fait passer ton textView au task mais cela ne garantit pas que textView.setText dans onPostExecute ne va pas lever une exception car je ne suis pas sûr qu'un simple new TextView(this) sera suffisant (tu dois essayer)

  7. #27
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2014
    Messages
    50
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 50
    Par défaut
    Citation Envoyé par mimir02 Voir le message
    comment connaitre l'id du textview?
    si tu l'as créé avec eclipse en utilisant l'éditeur graphique tu peux savoir son id en le sélectionnat et regardant l'id dans les propriétés.
    Puis dans ton code tu fais R.id.id_du_textview

  8. #28
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    ok je vais voir

  9. #29
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    il n'as pas d'id, pour le creer c'est bien: android:id="idtextview"?

  10. #30
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    ah non c'est: android:id="@+id/idtextview"

  11. #31
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2014
    Messages
    50
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 50
    Par défaut
    Citation Envoyé par mimir02 Voir le message
    ah non c'est: android:id="@+id/idtextview"
    donc tu peux utiliser R.id.idtextview le @+id/ sont des flags pour créer l'id au cas où il n'existe pas

  12. #32
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    ok. Par contre, pour mon programme, il faut un listview donc j'ai remplacé les text par list

  13. #33
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    Mais la, il me mets ces erreurs la:
    05-30 11:05:47.150: I/taghttppost(1427): java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
    05-30 11:05:47.440: I/Choreographer(1427): Skipped 125 frames! The application may be doing too much work on its main thread.
    05-30 11:05:47.520: D/dalvikvm(1427): GC_FOR_ALLOC freed 69K, 5% free 3207K/3344K, paused 47ms, total 49ms
    05-30 11:05:47.560: D/gralloc_goldfish(1427): Emulator without GPU emulation detected.

    le main:
    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
    package com.example.basedonnees;
     
     
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.util.ArrayList;
     
    //import org.apache.http.NameValuePair;
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;
     
    import android.app.ListActivity;
    import android.net.ParseException;
    import android.os.Bundle;
    import android.util.Log;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    import android.widget.Toast;
     
     
    public class MainActivity extends ListActivity {
        /** Called when the activity is first created. */
        InputStream isMain = null;
        TheTask task;
        String probleme= null;
     
        String result = null;
     JSONObject json_data=null;
     //ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
      ArrayList<String> donnees = new ArrayList<String>();
     
     
     
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
     
         try{
        	 setContentView(R.layout.fragment_main);
        	 ListView listeView = (ListView) findViewById(android.R.id.list); // à condition que l'id de ton TextView est bien ResultTextView
        	 task = new TheTask(this, listeView);
     
         //commandes httpClient
     
            task= new TheTask(this);
     
            task.execute("http://192.168.15.117/ecoles/projet.php");
     
     
         }
         catch(Exception e){
        	 	Log.i("taghttppost",""+e.toString());
     
     
                Toast.makeText(getBaseContext(),e.toString() ,Toast.LENGTH_LONG).show();
           }
        }   
         public void handleResult(InputStream is){
         	isMain=is;
     
     
     
     
          //conversion de la réponse en chaine de caractère
             try
             {
              BufferedReader reader = new BufferedReader(new InputStreamReader(isMain,"UTF-8"));
     
              StringBuilder sb  = new StringBuilder();
     
              String line = null;
     
              while ((line = reader.readLine()) != null) 
              {
              sb.append(line + "\n");
              }
     
              isMain.close();
     
              result = sb.toString();
     
             }
             catch(Exception e)
             {
              Log.e("tagconvertstr",""+e.toString());
             }
             //recuperation des donnees json
             try{
               JSONArray jArray = new JSONArray(result);
     
                  for(int i=0;i<jArray.length();i++)
                  {
     
                        json_data = jArray.getJSONObject(i);
                        donnees.add(json_data.getString("nom"));
                        //r.add(json_data.getString("categorie"));
     
                    }
                     setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, donnees));
                 }
                 catch(JSONException e){
                  Log.e("tagjsonexp",""+e.toString());
                 } catch (ParseException e) {
                  Log.e("tagjsonpars",""+e.toString());
            }
         }
     }
    le task:
    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
    package com.example.basedonnees;
     
    import java.io.InputStream;
    import java.util.ArrayList;
     
    import org.apache.http.HttpEntity;
    import org.apache.http.HttpResponse;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.util.EntityUtils;
     
    import android.os.AsyncTask;
    import android.util.Log;
    import android.widget.ListView;
     
     
    public class TheTask extends AsyncTask<String,String,String>
        {
    	private ListView listView;
    	public InputStream is;
    	public String entityStr;
    	MainActivity activity;
     
    public TheTask(MainActivity a, ListView t){
    	activity = a;
    	listView = t;
    }
     
    public TheTask(MainActivity a){
    	activity = a;
    }
     
    protected void onPostExecute(String result) {
        // TODO Auto-generated method stub
        super.onPostExecute(result);
        // update textview here
        activity.handleResult(is);
    }
     
    @Override
    protected void onPreExecute() {
        // TODO Auto-generated method stub
        super.onPreExecute();
    }
     
     
    @Override
    protected String doInBackground(String... params) {
    	ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
         try
            {
                HttpClient httpclient = new DefaultHttpClient();
                HttpPost method = new HttpPost(params[0]);
                method.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                HttpResponse response = httpclient.execute(method);
                HttpEntity entity = response.getEntity();
     
     
                if(entity != null){
                	entityStr=EntityUtils.toString(entity);
     
                	HttpClient httpclient2 = new DefaultHttpClient();
                	HttpPost method2 = new HttpPost(params[0]);
                    method2.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response2 = httpclient2.execute(method2);
                    HttpEntity entity2 = response2.getEntity();
     
                	is = entity2.getContent();
     
                    return entityStr;
                }
                else{
                    entityStr="No string.";
                    return entityStr;
                }
             }
             catch(Exception e){
            	 Log.i("entity=",e.toString());
                 entityStr="Network problem";
                 return entityStr;
             }
     
     
    }
    }
    et le "layout":
    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
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.example.basedonnees.MainActivity$PlaceholderFragment" >
     
        <ListView
            android:id="@+id/list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hello_world" />
     
    </RelativeLayout>

  14. #34
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2014
    Messages
    50
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 50
    Par défaut
    ça ne devrait pas être android.R.id.list
    mais R.id.list
    car il faut utiliser le R qui est généré dans ton projet com.example.basedonnees
    tu peux être sûr en allant dans le noued src/gen d'eclipse

  15. #35
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    c justement le programme qui me dit de le mettre comme ca: regarde les erreurs

  16. #36
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    La je crois qu'on peut pas faire mieux!
    05-30 11:23:15.840: D/AndroidRuntime(1577): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
    05-30 11:23:15.850: D/AndroidRuntime(1577): CheckJNI is ON
    05-30 11:23:15.930: D/dalvikvm(1577): Trying to load lib libjavacore.so 0x0
    05-30 11:23:15.940: D/dalvikvm(1577): Added shared lib libjavacore.so 0x0
    05-30 11:23:15.970: D/dalvikvm(1577): Trying to load lib libnativehelper.so 0x0
    05-30 11:23:15.970: D/dalvikvm(1577): Added shared lib libnativehelper.so 0x0
    05-30 11:23:15.970: D/dalvikvm(1577): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
    05-30 11:23:16.200: D/dalvikvm(1577): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
    05-30 11:23:16.910: E/memtrack(1577): Couldn't load memtrack module (No such file or directory)
    05-30 11:23:16.920: E/android.os.Debug(1577): failed to load memtrack module: -2
    05-30 11:23:17.260: D/AndroidRuntime(1577): Calling main entry com.android.commands.pm.Pm
    05-30 11:23:17.380: W/ActivityManager(380): No content provider found for permission revoke: file:///data/local/tmp/BaseDonnees.apk
    05-30 11:23:17.470: W/ActivityManager(380): No content provider found for permission revoke: file:///data/local/tmp/BaseDonnees.apk
    05-30 11:23:17.470: I/PackageManager(380): Copying native libraries to /data/app-lib/vmdl1517222127
    05-30 11:23:17.750: D/dalvikvm(380): GC_FOR_ALLOC freed 629K, 22% free 6384K/8084K, paused 83ms, total 83ms
    05-30 11:23:18.240: D/dalvikvm(380): GC_FOR_ALLOC freed 684K, 19% free 6609K/8084K, paused 87ms, total 88ms
    05-30 11:23:18.630: D/dalvikvm(380): GC_FOR_ALLOC freed 974K, 19% free 6600K/8084K, paused 85ms, total 85ms
    05-30 11:23:18.920: D/dalvikvm(380): GC_FOR_ALLOC freed 959K, 19% free 6601K/8084K, paused 84ms, total 84ms
    05-30 11:23:19.250: D/dalvikvm(380): GC_FOR_ALLOC freed 955K, 19% free 6608K/8084K, paused 91ms, total 91ms
    05-30 11:23:19.530: I/ActivityManager(380): Force stopping com.example.basedonnees appid=10054 user=-1: uninstall pkg
    05-30 11:23:19.530: I/ActivityManager(380): Killing 1560:com.example.basedonnees/u0a54 (adj 0): stop com.example.basedonnees
    05-30 11:23:19.540: W/ActivityManager(380): Force removing ActivityRecord{b4d9edc0 u0 com.example.basedonnees/.MainActivity t13}: app died, no saved state
    05-30 11:23:19.710: I/WindowState(380): WIN DEATH: Window{b5065688 u0 com.example.basedonnees/com.example.basedonnees.MainActivity}
    05-30 11:23:19.890: I/PackageManager(380): Package com.example.basedonnees codePath changed from /data/app/com.example.basedonnees-2.apk to /data/app/com.example.basedonnees-1.apk; Retaining data and using new
    05-30 11:23:20.060: I/PackageManager(380): Running dexopt on: com.example.basedonnees
    05-30 11:23:20.170: W/InputMethodManagerService(380): Got RemoteException sending setActive(false) notification to pid 1560 uid 10054
    05-30 11:23:20.170: I/Choreographer(539): Skipped 83 frames! The application may be doing too much work on its main thread.
    05-30 11:23:20.180: W/Binder(497): Caught a RuntimeException from the binder stub implementation.
    05-30 11:23:20.180: W/Binder(497): java.lang.NullPointerException
    05-30 11:23:20.180: W/Binder(497): at android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
    05-30 11:23:20.180: W/Binder(497): at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
    05-30 11:23:20.180: W/Binder(497): at android.os.Binder.execTransact(Binder.java:404)
    05-30 11:23:20.180: W/Binder(497): at dalvik.system.NativeStart.run(Native Method)
    05-30 11:23:20.230: I/Choreographer(380): Skipped 40 frames! The application may be doing too much work on its main thread.
    05-30 11:23:20.540: I/Choreographer(380): Skipped 38 frames! The application may be doing too much work on its main thread.
    05-30 11:23:21.180: I/Choreographer(380): Skipped 35 frames! The application may be doing too much work on its main thread.
    05-30 11:23:21.280: I/Choreographer(380): Skipped 67 frames! The application may be doing too much work on its main thread.
    05-30 11:23:22.920: D/dalvikvm(1588): DexOpt: load 962ms, verify+opt 1067ms, 1421892 bytes
    05-30 11:23:23.000: I/ActivityManager(380): Force stopping com.example.basedonnees appid=10054 user=-1: update pkg
    05-30 11:23:23.000: W/PackageManager(380): Code path for pkg : com.example.basedonnees changing from /data/app/com.example.basedonnees-2.apk to /data/app/com.example.basedonnees-1.apk
    05-30 11:23:23.000: W/PackageManager(380): Resource path for pkg : com.example.basedonnees changing from /data/app/com.example.basedonnees-2.apk to /data/app/com.example.basedonnees-1.apk
    05-30 11:23:23.110: D/dalvikvm(380): GC_FOR_ALLOC freed 940K, 18% free 6632K/8084K, paused 91ms, total 91ms
    05-30 11:23:23.320: I/ActivityManager(380): Force stopping com.example.basedonnees appid=10054 user=0: pkg removed
    05-30 11:23:23.410: D/dalvikvm(539): GC_EXPLICIT freed 219K, 13% free 4261K/4844K, paused 18ms+6ms, total 86ms
    05-30 11:23:23.540: I/InputReader(380): Reconfiguring input devices. changes=0x00000010
    05-30 11:23:23.640: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:23.640: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:23.640: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:23.650: I/PackageManager(380): Scheme: "sms"
    05-30 11:23:23.710: D/BackupManagerService(380): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.basedonnees flg=0x4000010 (has extras) }
    05-30 11:23:23.720: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:23.720: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:23.720: I/PackageManager(380): Scheme: "smsto"
    05-30 11:23:23.720: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:23.770: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:23.770: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:23.780: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:23.780: I/PackageManager(380): Scheme: "mms"
    05-30 11:23:23.840: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:23.840: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:23.840: I/PackageManager(380): Scheme: "mmsto"
    05-30 11:23:23.840: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.050: D/dalvikvm(522): GC_FOR_ALLOC freed 409K, 15% free 3380K/3956K, paused 95ms, total 98ms
    05-30 11:23:24.070: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.070: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.070: I/PackageManager(380): Scheme: "sms"
    05-30 11:23:24.070: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.220: D/dalvikvm(380): GC_FOR_ALLOC freed 1407K, 24% free 6194K/8084K, paused 104ms, total 107ms
    05-30 11:23:24.270: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.270: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.270: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.280: I/PackageManager(380): Scheme: "smsto"
    05-30 11:23:24.320: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.320: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.320: I/PackageManager(380): Scheme: "mms"
    05-30 11:23:24.320: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.390: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.390: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.390: I/PackageManager(380): Scheme: "mmsto"
    05-30 11:23:24.390: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.520: I/InputReader(380): Reconfiguring input devices. changes=0x00000010
    05-30 11:23:24.620: D/BackupManagerService(380): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.basedonnees flg=0x4000010 (has extras) }
    05-30 11:23:24.620: V/BackupManagerService(380): removePackageParticipantsLocked: uid=10054 #1
    05-30 11:23:24.640: V/BackupManagerService(380): addPackageParticipantsLocked: #1
    05-30 11:23:24.690: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.690: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.690: I/PackageManager(380): Scheme: "sms"
    05-30 11:23:24.690: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.830: D/dalvikvm(522): GC_FOR_ALLOC freed 439K, 16% free 3330K/3956K, paused 62ms, total 63ms
    05-30 11:23:24.850: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.850: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.850: I/PackageManager(380): Scheme: "smsto"
    05-30 11:23:24.850: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.900: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.900: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.900: I/PackageManager(380): Scheme: "mms"
    05-30 11:23:24.900: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:24.980: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:24.980: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:24.980: I/PackageManager(380): Scheme: "mmsto"
    05-30 11:23:24.980: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.050: W/ContextImpl(1126): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1479 android.content.ContextWrapper.startService:494 android.content.ContextWrapper.startService:494 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2419
    05-30 11:23:25.130: D/dalvikvm(380): GC_FOR_ALLOC freed 879K, 24% free 6171K/8084K, paused 118ms, total 118ms
    05-30 11:23:25.180: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:25.180: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:25.180: I/PackageManager(380): Scheme: "sms"
    05-30 11:23:25.180: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.230: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:25.230: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:25.230: I/PackageManager(380): Scheme: "smsto"
    05-30 11:23:25.230: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.320: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:25.320: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:25.320: I/PackageManager(380): Scheme: "mms"
    05-30 11:23:25.320: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.330: I/InputReader(380): Reconfiguring input devices. changes=0x00000010
    05-30 11:23:25.420: I/ActivityManager(380): Delay finish: com.android.keychain/.KeyChainBroadcastReceiver
    05-30 11:23:25.490: D/dalvikvm(522): GC_FOR_ALLOC freed 403K, 15% free 3376K/3956K, paused 32ms, total 34ms
    05-30 11:23:25.590: I/ActivityManager(380): Resuming delayed broadcast
    05-30 11:23:25.600: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.610: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:25.610: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:25.610: I/PackageManager(380): Scheme: "mmsto"
    05-30 11:23:25.700: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:25.700: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:25.700: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.710: I/PackageManager(380): Scheme: "sms"
    05-30 11:23:25.740: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:25.740: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.750: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:25.750: I/PackageManager(380): Scheme: "smsto"
    05-30 11:23:25.800: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:25.800: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:25.800: I/PackageManager(380): Scheme: "mms"
    05-30 11:23:25.800: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:25.940: D/dalvikvm(380): GC_EXPLICIT freed 790K, 23% free 6236K/8084K, paused 213ms+11ms, total 507ms
    05-30 11:23:25.940: D/dalvikvm(380): WAIT_FOR_CONCURRENT_GC blocked 115ms
    05-30 11:23:25.940: D/dalvikvm(380): WAIT_FOR_CONCURRENT_GC blocked 112ms
    05-30 11:23:25.940: D/dalvikvm(380): WAIT_FOR_CONCURRENT_GC blocked 111ms
    05-30 11:23:25.940: D/dalvikvm(380): WAIT_FOR_CONCURRENT_GC blocked 118ms
    05-30 11:23:25.950: D/dalvikvm(380): WAIT_FOR_CONCURRENT_GC blocked 116ms
    05-30 11:23:26.000: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:26.000: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:26.000: I/PackageManager(380): Scheme: "mmsto"
    05-30 11:23:26.000: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:26.060: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:26.060: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:26.060: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:26.070: I/PackageManager(380): Scheme: "sms"
    05-30 11:23:26.170: D/dalvikvm(522): GC_FOR_ALLOC freed 416K, 15% free 3375K/3956K, paused 34ms, total 36ms
    05-30 11:23:26.180: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:26.180: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:26.180: I/PackageManager(380): Scheme: "smsto"
    05-30 11:23:26.180: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:26.230: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:26.230: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:26.230: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:26.240: I/PackageManager(380): Scheme: "mms"
    05-30 11:23:26.320: I/PackageManager(380): Action: "android.intent.action.SENDTO"
    05-30 11:23:26.320: I/PackageManager(380): Category: "android.intent.category.DEFAULT"
    05-30 11:23:26.320: I/PackageManager(380): Scheme: "mmsto"
    05-30 11:23:26.320: I/PackageManager(380): Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
    05-30 11:23:26.390: D/AndroidRuntime(1577): Shutting down VM
    05-30 11:23:26.400: D/jdwp(1577): Got wake-up signal, bailing out of select
    05-30 11:23:26.400: D/dalvikvm(1577): Debugger has detached; object registry had 1 entries
    05-30 11:23:26.590: W/RecognitionManagerService(380): no available voice recognition services found for user 0
    05-30 11:23:27.530: D/AndroidRuntime(1593): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
    05-30 11:23:27.540: D/AndroidRuntime(1593): CheckJNI is ON
    05-30 11:23:27.630: D/dalvikvm(1593): Trying to load lib libjavacore.so 0x0
    05-30 11:23:27.640: D/dalvikvm(1593): Added shared lib libjavacore.so 0x0
    05-30 11:23:27.680: D/dalvikvm(1593): Trying to load lib libnativehelper.so 0x0
    05-30 11:23:27.680: D/dalvikvm(1593): Added shared lib libnativehelper.so 0x0
    05-30 11:23:27.680: D/dalvikvm(1593): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
    05-30 11:23:27.940: D/dalvikvm(1593): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
    05-30 11:23:28.680: E/memtrack(1593): Couldn't load memtrack module (No such file or directory)
    05-30 11:23:28.680: E/android.os.Debug(1593): failed to load memtrack module: -2
    05-30 11:23:29.060: D/AndroidRuntime(1593): Calling main entry com.android.commands.am.Am
    05-30 11:23:29.140: I/ActivityManager(380): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.basedonnees/.MainActivity} from pid 1593
    05-30 11:23:29.270: D/gralloc(50): Registering a buffer in the process that created it. This may cause memory ordering problems.
    05-30 11:23:29.270: E/libEGL(50): called unimplemented OpenGL ES API
    05-30 11:23:29.280: E/libEGL(50): called unimplemented OpenGL ES API
    05-30 11:23:29.280: E/libEGL(50): called unimplemented OpenGL ES API
    05-30 11:23:29.280: E/libEGL(50): called unimplemented OpenGL ES API
    05-30 11:23:29.280: E/SurfaceFlinger(50): glCheckFramebufferStatusOES error -1668151538
    05-30 11:23:29.280: E/SurfaceFlinger(50): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
    05-30 11:23:29.280: E/libEGL(50): called unimplemented OpenGL ES API
    05-30 11:23:29.280: E/libEGL(50): called unimplemented OpenGL ES API
    05-30 11:23:29.280: W/WindowManager(380): Screenshot failure taking screenshot for (164x246) to layer 21005
    05-30 11:23:29.330: D/AndroidRuntime(1593): Shutting down VM
    05-30 11:23:29.330: D/jdwp(1593): Got wake-up signal, bailing out of select
    05-30 11:23:29.330: D/dalvikvm(1593): Debugger has detached; object registry had 1 entries
    05-30 11:23:29.400: I/ActivityManager(380): Start proc com.example.basedonnees for activity com.example.basedonnees/.MainActivity: pid=1604 uid=10054 gids={50054, 3003}
    05-30 11:23:29.510: D/dalvikvm(1604): Not late-enabling CheckJNI (already on)
    05-30 11:23:29.660: I/Choreographer(380): Skipped 63 frames! The application may be doing too much work on its main thread.
    05-30 11:23:29.990: I/Choreographer(380): Skipped 33 frames! The application may be doing too much work on its main thread.
    05-30 11:23:30.320: I/Choreographer(380): Skipped 37 frames! The application may be doing too much work on its main thread.
    05-30 11:23:30.700: I/taghttppost(1604): java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
    05-30 11:23:31.100: I/Choreographer(1604): Skipped 194 frames! The application may be doing too much work on its main thread.
    05-30 11:23:31.170: D/gralloc_goldfish(1604): Emulator without GPU emulation detected.
    05-30 11:23:31.250: I/ActivityManager(380): Displayed com.example.basedonnees/.MainActivity: +1s929ms
    05-30 11:23:31.430: I/Choreographer(380): Skipped 30 frames! The application may be doing too much work on its main thread.
    05-30 11:23:31.830: I/Choreographer(380): Skipped 31 frames! The application may be doing too much work on its main thread.
    05-30 11:25:22.100: D/dalvikvm(380): GC_FOR_ALLOC freed 847K, 23% free 6261K/8084K, paused 133ms, total 135ms

  17. #37
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    J'ai bien l'appli qui se lance sur l'emulateur mais n'affiche rien.
    voici php au ca ou:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <?php
    // on se connecte à notre base  pour recuperer les data
    $base = mysqli_connect ('localhost', 'root', '');  
    mysqli_select_db ($base,'etablissements') ;  
    $req =mysqli_query($base,"SELECT nom from ecoles");
    while ($row=mysqli_fetch_array($req)) {    
        $output[]=$row;    
    } 
    //on encode en JSON 
    print(json_encode($output));
    mysqli_free_result ($req);  
    ?>

  18. #38
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2014
    Messages
    50
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 50
    Par défaut
    En regardant la doc il semble que dans ton cas le list view id doit être
    <ListView android:id="@android:id/list"

  19. #39
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    33
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 33
    Par défaut
    Super! Ca fonctionne! Merci beaucoup!

  20. #40
    Rédacteur
    Avatar de David55
    Homme Profil pro
    Ingénieur informatique
    Inscrit en
    Août 2010
    Messages
    1 542
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2010
    Messages : 1 542
    Par défaut
    Bonjour,

    Attention ceci représente les bases de la programmation Android. Vous trouverez beaucoup de documentation et de tutoriel la dessus. Il suffit juste d'utiliser Google

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. Problème variable globale
    Par nanoute dans le forum VB.NET
    Réponses: 2
    Dernier message: 29/08/2009, 13h03
  2. Problème variable globale contenant un stream !
    Par palmitoto dans le forum Lisp
    Réponses: 4
    Dernier message: 25/04/2008, 05h40
  3. Problème variables globales
    Par jcatala dans le forum ActionScript 1 & ActionScript 2
    Réponses: 0
    Dernier message: 20/03/2008, 20h22
  4. problème variable globale
    Par logarithme1984 dans le forum C++
    Réponses: 10
    Dernier message: 17/01/2007, 10h22
  5. [javascript] Problème variable globale !!!!
    Par LE NEINDRE dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 08/08/2005, 16h41

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