随笔 - 84  文章 - 16 评论 - 8 阅读 - 15万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

使用lib类库xUtils-2.6.10.jar作为数据请求的框架,在android的5.0版会有兼容问题,取不到GET请求的数据。

但是POST没有问题,难取到数据。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public static ResponseContext invokeGet(String url,
            List<NameValuePair> headers) {
        ResponseContext result = new ResponseContext();
        try {
            RequestParams requestParams = new RequestParams();
            if (headers != null && headers.size() > 0) {
                requestParams.addBodyParameter(headers);
            }
            result = invokeRequest(url, requestParams,
                    HttpRequest.HttpMethod.GET);
        } catch (Exception e) {
            String messageString = e.getMessage();
            result.setMessage(messageString);
            Log.e(TAG, messageString);
        }
        Log.d(TAG, "over");
        return result;
    }

调试发现,返回的结果result是null值。

 

解决办法:

升级类库:xUtils-2.6.10.jar--->xUtils-2.6.14.jar

posted on   Mack.Meng  阅读(368)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示