BasicNetwork.performRequest:凌空中的意外响应代码500

时间:2017-10-10 07:28:43

标签: android android-volley

// URL
String CategoryUrl =“http://lazurd.com/shop/api/rest/custom/categories/”;

    StringRequest request = new StringRequest(Request.Method.GET,CategoryUrl,new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.d("CODDE",response );


        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError volleyError) {

            Toast.makeText(MainActivity.this,"ERROR",Toast.LENGTH_LONG).show();

        }
    });

    RequestQueue queue = Volley.newRequestQueue(this);
    queue.add(request);

BasicNetwork.performRequest:http://lazurd.com/shop/api/rest/custom/categories/

的意外响应代码500

1 个答案:

答案 0 :(得分:0)

final TextView mTextView = (TextView) findViewById(R.id.text);
...

// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(this);
String url ="http://lazurd.com/shop/api/rest/custom/categories/";

// Request a string response from the provided URL.
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
            new Response.Listener<String>() {
    @Override
    public void onResponse(String response) {
        // Display the first 500 characters of the response string.
        mTextView.setText("Response is: "+ response.substring(0,500));
    }
}, new Response.ErrorListener() {
    @Override
    public void onErrorResponse(VolleyError error) {
        mTextView.setText("That didn't work!");
    }
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
相关问题