It is easy to maintain progress bar state when i use AysncTask with fragments Callback but how should i achieve it with volley? I can't use AsyncTask because it is outdated and volley is better and faster. Any Help or Hint will be grateful.
I am using google's volley to Post and Get Requests
Aryan Kumar
27-Jun-2023Sure, here is how to maintain the progress bar state using Volley Android:
Code snippet
This code creates a
ProgressDialogHandler
class that can be used to maintain the state of a progress bar. The class has three methods:show()
,dismiss()
, andsetProgress()
. Theshow()
method shows the progress dialog, thedismiss()
method dismisses the progress dialog, and thesetProgress()
method sets the progress of the progress dialog.To use the
ProgressDialogHandler
class, you would first create an instance of the class. Then, you would call theshow()
method to show the progress dialog. Once the progress dialog is shown, you can call thesetProgress()
method to update the progress of the progress dialog. Finally, you would call thedismiss()
method to dismiss the progress dialog.Here is an example of how to use the
ProgressDialogHandler
class:Code snippet
In this example, the progress dialog is shown and the progress is updated to 50%. Then, some work that takes some time is done. After the work is done, the progress is updated to 100% and the progress dialog is dismissed.
Anonymous User
12-Jan-2016