Last active
June 2, 2016 09:13
-
-
Save wutianlong/6a817a8c196a40320df0 to your computer and use it in GitHub Desktop.
Handler-Optimized
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private WeakReference<ClassName> mActivityWeakReference = new WeakReference<ClassName>(this); | |
private final Handler mHandler = new InnerHandler(mActivityWeakReference); | |
private static class InnerHandler extends Handler { | |
WeakReference<ClassName> activityWeakReference; | |
InnerHandler(WeakReference<ClassName> activityWeakReference) { | |
this.activityWeakReference = activityWeakReference; | |
} | |
public void handleMessage(android.os.Message msg) { | |
if (activityWeakReference.get()!=null){ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment