LoopJ AndroidAsyncHttp错误

时间:2014-10-29 12:27:01

标签: android android-async-http

任何人都能解释为什么代码的和平无效吗? 我在网上搜索了一些样本,我觉得我错过了一些东西。 谢谢!

                    RequestParams params = new RequestParams();
                    params.put("d", dataVarAll);

                    AsyncHttpClient client = new AsyncHttpClient();

                    client.get(" http://10.0.0.89/Data/D", params, new AsyncHttpResponseHandler()
                    {

                        @Override
                        public void onStart() {
                            // called before request is started
                            consoleText.setText("Start...");
                        }

                        @Override
                        public void onRetry(int retryNo) {
                            // called when request is retried
                            consoleText.setText("Retry");
                        }

                        @Override
                        public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
                            // TODO Auto-generated method stub
                            consoleText.setText(new String(arg2));
                            Log.v("FAILURE: ", (new String(arg2)));
                            //consoleText.setText(arg1.toString());
                        }

                        @Override
                        public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
                            // TODO Auto-generated method stub
                            consoleText.setText(new String(arg2));
                        }
                    });

1 个答案:

答案 0 :(得分:2)

据我所知,第一个错误是URL中的空格: 这样:

client.get(" http://10.0.0.89/Data/D", params, new AsyncHttpResponseHandler()

对此:

client.get("http://10.0.0.89/Data/D", params, new AsyncHttpResponseHandler()