小编Saa*_*aad的帖子

为什么我不能在android中获得json?

我在获取一维方面遇到问题 JSON请指导我问题在我JSON或我的代码中?

JSON:

{
    "data": {
        "id": "S000010",
        "name": "ZS Solutions",
        "email": "zswebs@gmail.com",
        "phone": "051-1234567",
        "address": "p.o.box 123",
        "about": "im the company\r\nHAhahhaa"
    }
}
Run Code Online (Sandbox Code Playgroud)

Android活动JSON检索代码:

ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
// TODO Auto-generated method stub
try {
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("abc.php?Id="+id+"");

    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    HttpResponse hresponse = httpclient.execute(httppost);
    HttpEntity entity = hresponse.getEntity();
    is = entity.getContent();
    String result=co(is);
    JSONObject json=new JSONObject(result);

    JSONArray a=  json.getJSONArray(data);
    for (int i = 0; i <= …
Run Code Online (Sandbox Code Playgroud)

php android json

0
推荐指数
1
解决办法
108
查看次数

标签 统计

android ×1

json ×1

php ×1