android json到listview

android json到listview,android,json,arraylist,Android,Json,Arraylist,我正在使用android和JSON。到目前为止,我已经完成了,但是我无法在arraylist中设置ID。错误将出现在“json_data.getInt(“ID”)中” 你能帮我吗 public void klussenlijst() { ArrayList<String> results = new ArrayList<String>(); JSONObject json_data; mysql client = new m

我正在使用android和JSON。到目前为止,我已经完成了,但是我无法在arraylist中设置ID。错误将出现在“json_data.getInt(“ID”)中”

你能帮我吗

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

    }
public void klussenlijst()
{
ArrayList结果=新建ArrayList();
JSONObject json_数据;
mysql客户端=新的mysql(“http://www.****************/php?actie=klussen“;
试一试{
client.Execute(RequestMethod.POST);
}捕获(例外e){
e、 printStackTrace();
}
字符串响应=client.getResponse();
试试{;
JSONArray jArray=新JSONArray(响应);

对于(inti=0;i不确定您的mysql()方法和错误处理的巨大缺陷,但是您确定您的项目在您的AndroidManifest.xml文件中允许INTERNET权限吗?听起来您的getInt不是int。

eclipse中没有错误。只有当我在android手机中运行时,我的程序自动关闭,您才能打印出什么“响应”看起来可以帮助我们更好地调试它。