Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
static class MyHandler extends Handler {
private final WeakReference<MyActivity> mRef;
MyHandler(MyActivity activity) {
mRef = new WeakReference<HomeActivity>(activity);
public void handleMessage(Message msg) {
MyActivity activity = mRef.get();
if (activity != null) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.