You will need to create a runnable that does your refreshing, then reschedules itself to run again in 5 seconds.
private Runnable runnable = new Runnable() {
@Override
public void run() {
refresh();
handler.postDelayed(this, 5000);
}
};
Whereever you want to start refreshing, do this
private Handler handler = new Handler();
handler.postDelayed(runnable, 5000);
Hope this helps