0

I have a functionnal Android app send request with Volley and get response in JsonObject. Now, I need to include an image in my request and I don't have any idea how I can do that, and still receive my response in a JsonObject.

Thank you for helping.

Fabien.

1 Answer 1

1
 JsonMultipartRequest<Upload> request = new JsonMultipartRequest<Upload>(Method.POST, apiUrl, mListener, mErrorListener); request.addFile("photo", image_path); RequestQueue mRequestQueue = Volley.newRequestQueue(getApplicationContext()); mRequestQueue.addRequest(request); mRequestQueue.start(); 

JsonMulitpartRequest is extended class of MultipartRequest where Override the below method to make it JSON object parseNetworkResponse

This is using library VolleyPlus

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for this track but I was hopping to a solution with Volley himself because it's really well integrated in my project already. Do you think I can implement VolleyPlus easily without regression on my existant code with Volley ?
Thank you for your answer. I can't valid it because I don't have enough reputation yet but I will come back when I can. Most important : IT'S WORKS. We just need to add request.addMultipartParam(name, contentType, value) for others params that are strings in the same request.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.