Lukáš Šálek Lukáš Šálek - 1 year ago 104
JSON Question

How to get JSON from server without send JSON request

I need help.
I use volley for sending json object to my rest API server. And i get data from this API to my app (json). Its work fine:

JsonObjectRequest mJsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, JSONDATA, JSONListener, errorListener)

And now I want to send request without
(i can't set null). It is for global values. There is not necessary send some data. And i dunno how to send this request. Can you help me?

Answer Source

till i understand ur problem my answer is this

StringRequest distRequest=new StringRequest(Request.Method.POST, YOUR_URL, new Response.Listener<String>() {
             @Override             public void onResponse(String response) {      
 Toast.makeText(MainActivity.this, " "+response.toString, Toast.LENGTH_SHORT).show();           

        }, new Response.ErrorListener() {
           public void onErrorResponse(VolleyError error) {
                Toast.makeText(MainActivity.this, " "+error.toString, Toast.LENGTH_SHORT).show();

        RequestQueue distQueue=Volley.newRequestQueue(this);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download