2

我在 Android 上使用Koush Ion来处理网络操作。我想添加一个通用处理程序来处理 401 未经授权的错误。我该怎么做?

谢谢你

4

1 回答 1

3
Ion.with(this)
            .load("http://google.com")
            .asString()
            .withResponse()
            .setCallback(new FutureCallback<Response<String>>() {
                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if(result.getHeaders().code()){
                        // ............
                    }
                }
            });

祝你好运!

于 2015-03-10T05:19:55.950 回答