java - JSON request using Volley -


im trying make json request using volley, able make request using stringrequest have error when trying jsonrequest.

private void postdata(final string param, final textview tv) {     requestqueue request = volley.newrequestqueue(this);      jsonobjectrequest postreq = new jsonobjectrequest(request.method.get, url_login, new response.listener<jsonreader>() {         @override         public void onresponse(jsonreader response) {             tv.settext(response); // set response data in textview         }     }, new response.errorlistener() {         @override         public void onerrorresponse(volleyerror error) {             system.out.println("error [" + error + "]");         }     }) {         /**          * add headers request          * @return headers          * @throws authfailureerror          */         @override         public map getheaders() throws authfailureerror {             map headers = new hashmap();             headers.put("customheader", "somecrap");             system.out.println(headers); //testing output of headers             return headers;         }     };     request.add(postreq); } 

im getting error under tv.settext(response);

cannot resolve method 'settext(android.util.jsonreader)'

i output json request test text in textview labelled "tv"

thank you

textview not accept jsonreader. need charsequence or string that.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -