0

I working with android and JSON. I came so far, but I can's set the ID in the arraylist.The error will be in "json_data.getInt("ID")"

Can sombody help me

    public void klussenlijst()
    {
ArrayList<String> results = new ArrayList<String>();
        JSONObject json_data;
        mysql client = new mysql("http://www.****************/klussen.php?actie=klussen");

        try {
            client.Execute(RequestMethod.POST);
        } catch (Exception e) {
            e.printStackTrace();
        }

        String response = client.getResponse();

        try{;
        JSONArray jArray = new JSONArray(response);
             for(int i=0;i<jArray.length();i++){
             json_data = jArray.getJSONObject(i);
             results.add(json_data.getInt("ID"),(String) json_data.get("titel").toString());
            }
             filllist();


             }
             catch(JSONException e){
                 e.printStackTrace();
             }

    }
Wouter van Reeven
  • 517
  • 3
  • 8
  • 16

1 Answers1

0

Not sure about your mysql() method and the huge lack of error handling, but are you sure that your project has allowed for INTERNET permissions in your AndroidManifest.xml file? Sounds to me like your getInt is not an int.

JPM
  • 9,077
  • 13
  • 78
  • 137