Back to project page mcdroid.
The source code is released under:
Apache License
If you think the Android project mcdroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** * //from www. j a v a 2 s. co m */ package cn.mibcxb.android.os; import java.lang.ref.SoftReference; import android.os.Handler; import android.os.Looper; import android.os.Message; /** * @author mibcxb * */ public class McHandler<T> extends Handler { private final SoftReference<T> reference; public McHandler(T r) { this.reference = new SoftReference<T>(r); } public McHandler(T r, Callback callback) { super(callback); this.reference = new SoftReference<T>(r); } public McHandler(T r, Looper looper) { super(looper); this.reference = new SoftReference<T>(r); } public McHandler(T r, Looper looper, Callback callback) { super(looper, callback); this.reference = new SoftReference<T>(r); } @Override public final void handleMessage(Message msg) { T r = reference.get(); if (r != null) { handleMessage(r, msg); } } public void handleMessage(T r, Message msg) { } }