Mauricio Ramos Mauricio Ramos - 1 month ago 6
Android Question

How to load information every minute in android?

I am making an app that shows the results of soccer matches live, I am making a request json format with the library volley and let me know if you can make that request every minute. Any method seemed to setInterval in javascript

Answer
private final static int INTERVAL = 1000 * 60 * 1;
Handler mHandler = new Handler();

Runnable mHandlerTask = new Runnable()
{
    @Override 
    public void run() {
         doSomething();
         mHandler.postDelayed(mHandlerTask, INTERVAL);
    }
};

call mHandlerTask.run(); whenever you want to start the task and replace doSomething() function with your volley request code.