Retrofit "illegalstateexception: Already Executed"
I have a Retrofit network call that id like to run every 5 seconds. My current code: Handler h = new Handler(); int delay = 5000; //milliseconds h.postDelayed(new Runnable() {
Solution 1:
A Call
can only be used once. Its documentation tells you how to use one multiple times:
Use
clone()
to make multiple calls with the same parameters to the same webserver; this may be used to implement polling or to retry a failed call.
So use call.clone().enqueue(..)
for Asynchornous and call.clone().execute()
for Synchornousrespectively to ensure that you have a fresh, unexecuted Call
for each request.
Post a Comment for "Retrofit "illegalstateexception: Already Executed""