Multipart post with Volley with progress without using HttpEntity

I saw the following message: A working multi-page POST request with volleyball and without HttpEntity

My problem is how to turn on the progress bar.

There are solutions around the progress bar, but they all use the HttpClient, which I want to avoid as it is deprecated.

I just can't figure out how to combine the two.

Edit:

I am looking for a progress bar that shows a percentage, not just a continuous circle. An example with the bar that I want appears here, but uses HTTPClient: How to send POST in the format "multipart / form-data" on Android with Volley

+5
source share
1 answer

It seems simple to me if I am not mistaken in the problem. Why don't you start showing your progress bar (preferably indefinite), and when your requests succeed or fail, you just stop the progress bar.

Something like that: -

myRequest(){ //Start Showing your progress bar here showProgressBar(); JsonObjectRequest myRequest = new JsonObjectRequest(Request.Method.GET, URL, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { //Hide progress bar here hideProgressDialog(); //TODO: I forgot what to do } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { //Hide progress bar here hideProgressDialog(); } }); queue.add(myRequest); } 

Hope this helps :)

0
source

Source: https://habr.com/ru/post/1244142/


All Articles