小编Shu*_*ang的帖子

okhttp来自Response的新JsonObject

我正在尝试使用OKHttphttps://github.com/hongyangAndroid/okhttp-utils实现登录功能,但是我不知道如何JsonObject在回调中创建新的使用响应。

  OkHttpUtils.post()
            .url(url)
            .addParams("phone", "18681873411")
            .addParams("password", "18681873411")
            .build()
            .execute(new Callback() {
                @Override
                public Object parseNetworkResponse(Response response) throws Exception {
                    Log.i("ws","---->>parseNetworkResponse" + response.body().string());


                    JSONObject jsonObj = null;
                    try {
                        jsonObj = new JSONObject(response.body().string());
                    } catch (JSONException e) {
                        Log.i("ws","---->>JSONException");
                        e.printStackTrace();
                    } catch (IOException e) {
                        Log.i("ws","---->>IOException");
                        e.printStackTrace();
                    }
                    Log.i("ws","---->>111 :" );
                    String opCode = jsonObj.getString("OpCode");
                    String message = jsonObj.getString("Message");
                    Log.i("ws","---->>111 opCode:" + opCode);
                    Log.i("ws","---->>111 Message:" + message);
                    JSONObject result = new JSONObject();
                    result.put("qrcode",opCode);
                    result.put("message", message); …
Run Code Online (Sandbox Code Playgroud)

android androidhttpclient okhttp

5
推荐指数
1
解决办法
6555
查看次数

android系统动画时长

我只是想知道android系统动画(Activity A切换到Activity B的动画)持续时间是多长,以及如何测量这个时间。我应该使用一些工具还是在代码中使用日志?

android android-animation android-activity android-kernel

5
推荐指数
1
解决办法
9065
查看次数

onSuccess(int,Header [],JSONObject)未被覆盖,但收到了回调

我使用android-async-http,并覆盖所有onSuccessonFailure方法,但我收到错误: onSuccess(int, Header[], JSONObject) was not overriden, but callback was received.

cz.msebera.android.httpclient.client.HttpResponseException: Not Found
Run Code Online (Sandbox Code Playgroud)

我只是想知道我真的覆盖了这个方法.我也得到了日志:onSuccess JSONObject:{"error":null,"success":false}

  public static void querySecurityCode(String username) {
        RequestParams params = new RequestParams();
        params.put("username", username);
        VStarRestClient.getClient().setEnableRedirects(true);
        VStarRestClient.post(GET_SECURITY_CODE_URL, params, new JsonHttpResponseHandler(){
            @Override
            public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
                super.onSuccess(statusCode, headers, response);
                Log.i("ws", "---->>onSuccess JSONObject:" + response);
            }

            @Override
            public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
                super.onSuccess(statusCode, headers, response);
                Log.i("ws", "---->>onSuccess JSONArray");
            }

            @Override
            public …
Run Code Online (Sandbox Code Playgroud)

android httphandler asynchttpclient androidhttpclient

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