2011-02-05 8 views
0

나는 android와 JSON으로 작업하고 있습니다. 지금까지왔다,하지만 난의는android json to listview

이 sombody 당신의 MySQL의에 대해 나에게 확실하지

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

+0

eclipse에는 오류가 없습니다. 안드로이드 폰에있는 프로그램 만 자동으로 종료됩니다. –

+0

더 나은 디버깅을 돕기 위해 "응답"이 어떻게 생겼는지 인쇄 할 수 있습니까? – JPM

답변

0

도와 드릴까요 "(ID") "json_data.getInt"에있을 것입니다 arraylist.The 오류의 ID를 설정할 수 있습니다() 메소드와 오류 처리의 엄청난 부족,하지만 귀하의 프로젝트가 귀하의 AndroidManifest.xml 파일에서 인터넷 사용 권한을 허용하고 있습니까? 당신의 getInt가 int가 아닌 것처럼 들리는군요.