Back to project page iLitIt_Android.
The source code is released under:
GNU General Public License
If you think the Android project iLitIt_Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.unifreiburg.es.iLitIt; /* www .j ava 2 s . c o m*/ import android.os.Handler; import android.os.Looper; /** * Created by phil on 11/19/14. */ public class DelayedObserver<E> implements ObservableLinkedList.Observer<E> { protected static Handler mHandler; protected Runnable mAction; private long mDelay; public final static long DEFAULT_DELAY = 500; public E mObject; public ObservableLinkedList<E> mList; public DelayedObserver(long delay, Runnable r) { if (mHandler==null) mHandler = new Handler(Looper.getMainLooper()); mAction = r; mDelay = delay; } @Override public void listChanged(ObservableLinkedList<E> list, E object) { mList = list; mObject = object; mHandler.removeCallbacks(mAction, null); mHandler.postDelayed(mAction, mDelay); } }