Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LoopJ AndroidAsyncHttp error

Can anyone explain why this peace of code is not working? I checked everything as in some sample online and I have the feeling I am missing something. Thanks!

                    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));
                        }
                    });
like image 551
Mumb Hamata Avatar asked Sep 14 '26 21:09

Mumb Hamata


1 Answers

As far as I see the first error is the space in the URL: This:

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

To this:

client.get("http://10.0.0.89/Data/D", params, new AsyncHttpResponseHandler()                    
like image 59
msysmilu Avatar answered Sep 17 '26 11:09

msysmilu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!