خرید بک لینک

Vote count: 0

I get an error when I receive the response from a REST server. I found few topics with the same problem but still can't find the solution. This is my code

public void clickFunc(View v){

        String url = "http://localhost:8080/Server/file/04";
        final CustomJSONObjectRequest jsonRequest = new CustomJSONObjectRequest(Request.Method.GET, url, new JSONObject(), this, this);
        jsonRequest.setTag(REQUEST_TAG);
        mQueue.add(jsonRequest);
}

@Override
    public void onErrorResponse(VolleyError error) {
      //  mTextView.setText(error.getMessage());
        Log.i("test","error "+error.getMessage());
    }

    @Override
    public void onResponse(Object response) {
       // mTextView.setText("Response is: " + response);
        //  mTextView.setText(mTextView.getText() + "" + ((JSONObject) response).getString ("name"));
        Log.i("test","ok");
       // Log.i("test",response.toString());
    }

The error is

type org.json.JSONArray caot be converted to JSONObject

I tried to change the response fucntion in this way

public void onResponse(JSONArray response)

But I get an error: Method does not override ...

asked 30 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 11 ارديبهشت 1395 ساعت: 2:03

صفحه بندی