Questions tagged [android-volley]

Volley is a Google library for Android that makes networking and remote image loading easier and faster.

Written by Ficus Kirkpatrick and his team, Volley is a library released by Google at I/O 2013. The Google Play Store and a number of apps by Google use this library to perform network requests and remote image loading. The developers at Google claim that network requests performed through Volley are up to 10 times faster than other libraries according to their tests. There is also an official documentation and a Github.

You can clone the GIT repository by running this command:

git clone https://android.googlesource.com/platform/frameworks/volley
6757 questions
73
votes
5 answers

How to send a POST request using volley with string body?

I'm developing an Android app that communicate with a RESTful web service I wrote. Using Volley for GET methods is awesome and easy, but I can't put my finger on the POST methods. I want to send a POST request with a String in the body of the…
itaied
  • 6,827
  • 13
  • 51
  • 86
71
votes
2 answers

Android: How handle message error from the server using Volley?

I am using Volley for my Android app to fetch data from my server. It works well except when handling the error from my server. My server sends this response when there is a mistake: { "status": 400, "message": "Errors (2): A name is…
FlavienBert
  • 1,674
  • 3
  • 16
  • 17
65
votes
18 answers

Android Volley double post when have slow request

I have a problem with Volley POST request on slow network. Everytime I see BasicNetwork.logSlowRequests in my LogCat, my POST request is executed twice or more resulting multiple (2 or more) postings for 1 request. I already set the retry policy to…
aristo_sh
  • 4,848
  • 2
  • 13
  • 13
62
votes
3 answers

How can I return value from function onResponse of Volley?

public class getString { String tag_string_req = "string_raq"; String url = "http://10.0.2.2/eat/locations/index.json"; String result=""; public String get_String() { StringRequest strReq = new StringRequest(Request.Method.GET, url, new…
Wubin Ouyang
  • 777
  • 1
  • 7
  • 9
62
votes
11 answers

Using cookies with Android volley library

Does anybody know how to attach a session cookie to the request using com.android.volley library? When I log in to a web site it gives me a session cookie. Browser would send that cookie back with any subsequent request. Volley does not seem to do…
Rastio
  • 1,506
  • 1
  • 13
  • 18
60
votes
10 answers

Making a HTTPS request using Android Volley

I am trying to make a https request using this code: RequestQueue queue = Volley.newRequestQueue(getApplicationContext()); request = new Request(Request.Method.GET,"https://devblahblahblah.com/service/etc",errListener); but I am getting…
Abdullah Shoaib
  • 2,065
  • 2
  • 18
  • 26
57
votes
5 answers

Android volley sending data twice

I am using Volley Network Library in my application. The Issue is that it is sending data more than once when network connection is slow. And After I Google this issue, all i can find about this issue is below…
Shashikala Chavan
  • 573
  • 1
  • 4
  • 9
50
votes
4 answers

Android Volley + JSONObjectRequest Caching

public class CustomRequest extends JsonObjectRequest { public CustomRequest(String url, JSONObject params, Listener listener, ErrorListener errorListener) throws JSONException { super(Method.POST,url,…
gaara87
  • 2,087
  • 3
  • 21
  • 43
49
votes
4 answers

Volley and AsyncTask

I read a post about Volley and I know it's great networking library. But I couldn't understand one thing. All requests are Async Task or not? When I want to send asyncTask request using Volley do I need put Volley request in AsyncTask? or should I…
pmb
  • 2,327
  • 3
  • 30
  • 47
46
votes
8 answers

Send form-urlencoded parameters in post request android volley

I want to make a POST JSONObjectRequest with form urlencoded parameters. How can I do this? I've tried the following code, but to no avail. final String api = "http://api.url"; final JSONObject jobj = new JSONObject(); jobj.put("Username",…
user4071017
  • 461
  • 1
  • 4
  • 3
45
votes
8 answers

Http Status Code in Android Volley when error.networkResponse is null

I am using Google Volley on the Android platform. I am having a problem in which the error parameter in onErrorResponse is returning a null networkResponse For the RESTful API I am using, I need to determine the Http Status Code which is often…
David Manpearl
  • 12,362
  • 8
  • 55
  • 72
45
votes
4 answers

Unit testing with Android volley

I would like to know how can I create unit tests for the volley framework. Mock the requests, the responses so that I can create unit tests that wont require a webservice to be working and network accesss. I've googled it but I don't find much…
apinho
  • 2,235
  • 3
  • 25
  • 39
45
votes
4 answers

Android Studio + Volley

I'm new to Android Studio and I want to use Volley library for my app but i can't add the source as a library in Android Studio. I've searched the web but couldn't find anything. Everywhere is said to import as a library but I don't know how. I got…
Jilberta
  • 2,836
  • 5
  • 30
  • 44
43
votes
6 answers

Handle Volley error

I want to handle and show some message in onErrorResponse below is my code. String url = MainActivity.strHostUrl+"api/delete_picture"; jobjDeleteImage = new JsonObjectRequest(Request.Method.POST, url, jobj, new Response.Listener() { …
Girish Bhutiya
  • 3,111
  • 5
  • 31
  • 50
40
votes
15 answers

Volley JsonObjectRequest Post parameters no longer work

I am trying to send POST parameters in a Volley JsonObjectRequest. Initially, it was working for me by following what the official code says to do of passing a JSONObject containing the parameters in the constructor of the JsonObjectRequest. Then…
Joshua C.
  • 921
  • 1
  • 10
  • 12