2011-02-05 81 views
0

我使用android和JSON。我来到到目前为止,但我的设置ID在arraylist.The错误将在“json_data.getInt(” ID“)”android json to listview

能sombody帮我

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(); 
      } 

    } 
+0

什么是“错误”? – CommonsWare 2011-02-05 22:01:15

回答

0

不知道关于你的mysql ()方法和大量缺乏错误处理,但是你确定你的项目已经允许你的AndroidManifest.xml文件中有INTERNET权限吗?听起来像你的getInt不是一个整数。