public class DelayedObserver extends ContentObserver { private final Handler processHandler = new Handler(Looper.getMainLooper()); private final Runnable work; private final long delay; public QueueObserver(Runnable work, long delay) { super(processHandler); this.work = work; this.delay = delay; } @Override public void onChange(boolean selfChange) { processHandler.removeCallbacksAndMessages(null); processHandler.postDelayed(work, delay); } }
1 Person is following this question.