Here is my layout code
static String userLocation(String url) {
RequestQueue queue = Volley.newRequestQueue(context);
StringRequest dr = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>()
{
@Override
public void onResponse(String response) {
res=response;
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), "error"+error, Toast.LENGTH_LONG).show();
Log.d("error", ""+error);
}
}
);
queue.add(dr);
return res;
}
When I push the answer to the same method, then the answer prints fine and when I call the method and print the return statement, then res prints null.
Any help is appreciated. Thank you in advance.
Please suggest me how we can share answers in one or more actions.
And sorry for my bad english ..
source
share