android handle弱引用

public class WeakReferenceHandle extends Handler {
        private final WeakReference<Context> mContext;
        public WeakReferenceHandle(Context context) {
            mContext = new WeakReference<Context>(context);
        }
        @Override
        public void handleMessage(Message msg) {
            if(mContext.get() == null) {
                return;
            }
        }
}

你可能感兴趣的:(优化)