Skip to content
Advertisement

Repeat Volley Request Every x-seconds Java

Alright – Before you say this is a duplicate, I’ve looked over every stack overflow article I can find, and none of them work and/or answer the question properly/simply. All I need is to repeat a function with a volley request inside of it every x-seconds.

Basically, I have a fairly simple Volley request inside a function, which works absolutely perfectly on one call.

Volley function:

JavaScript

I just want to call this function periodically, to receive data from the server and update my bus-position data. There has to be a fairly simple way to do this? I know I must be missing something, but none of the other answers seem to help.

Also, as I’m using Google maps, my class is already extending FragmentActivity. I’ve seen methods that extend Runnable to get this working — but my Java is a bit rusty here. I’ve been doing too much JS.

Advertisement

Answer

JavaScript

Try this out and add this in the same scope as SetBusPosition()

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement