Skip to content Skip to sidebar Skip to footer

Android - Best Practice Approach For Refreshing Page Data At A Certain Interval?

I have a page that goes out to the database and gets the latest data. The problem is that multiple users can access that data. So if someone adds to the data, the current screen d

Solution 1:

Assuming you are using a WebView, you can try something like this,

// Wait 60 seconds before reloading
private static final int WAIT_TIME = 60000;

mWebView = (WebView) findViewById(R.id.MyWebView);
mWebView.loadUrl(/* ENTER URL HERE */);

new Timer().schedule(new TimerTask(){
    @Override
    public void run() {
         mWebView.reload();
    }
}, WAIT_TIME, WAIT_TIME);

Post a Comment for "Android - Best Practice Approach For Refreshing Page Data At A Certain Interval?"