Java – set request prioritization
•
Java
I am using the volley Library in Android to set the priority of my request I can't find out how to prioritize requests
StringRequest request = new StringRequest(Request.Method.GET,"Feed URL",volleyListener,volleyErrorListener); pe.requestQueue.add(request);
What do you think I should do?
Solution
Unfortunately, the library is not fully fleshed out To set the priority of the request, you need to extend the request and override getpriority() For your example, I'll create a new class that extends stringrequest and implements getpriority() (or setpriority(), so you can programmatically change the priority in different requests)
private Priority mPriority = Priority.LOW; @Override public Priority getPriority() { return mPriority; } public void setPriority(Priority priority) { mPriority = priority; }
The priority is enum from the request class
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码