小编use*_*280的帖子

JSONException:在字符 0 处输入结束

我正在尝试从服务器获取 JSON 值。我不知道我的代码有什么问题。我正在使用AsyncTask,这是我的代码doInBackground

代码:

@Override
    protected Void doInBackground(List<String>... articlesRec) {
        for (List<String> articlesPostValue : articlesRec) {
            event = articlesPostValue.get(0);
            category = articlesPostValue.get(1);
            paged = articlesPostValue.get(2);
            deviceID = articlesPostValue.get(3);
        }

        List<NameValuePair> articlesPostValues = new ArrayList<NameValuePair>();
        articlesPostValues.add(new BasicNameValuePair("_event", event));
        articlesPostValues.add(new BasicNameValuePair("cat", category));
        articlesPostValues.add(new BasicNameValuePair("paged", paged));
        articlesPostValues.add(new BasicNameValuePair("_deviceID", deviceID));

        HttpClient hc = new DefaultHttpClient();
        HttpPost hp = new HttpPost(AutoLifeConstants.BASE_URL);

        try {
            hp.setEntity(new UrlEncodedFormEntity(articlesPostValues));

            // Execute HTTP Post Request
            HttpResponse response = hc.execute(hp);

            String result = EntityUtils.toString(response.getEntity());
            String jsontext = new …
Run Code Online (Sandbox Code Playgroud)

android json android-asynctask

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

android-asynctask ×1

json ×1