Code example for WeakReference

0
    } 
 
    @Override 
    public void setCustomView(View view) {
        mContextView.setCustomView(view);
        mCustomView = view != null ? new WeakReference<View>(view) : null;
    } 
 
    @Override 
    public void invalidate() { 
        mCallback.onPrepareActionMode(this, mMenu);
    } 
 
    @Override 
    public void finish() { 
        if (mFinished) {
            return; 
        } 
        mFinished = true;
 
        mContextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);