Code example for WeakReference

Methods: get

         * This is when the view references are actually evaluated. 
         * @param activityOrFragment an activity or fragment 
        protected void reallyInjectMemberFragments(Object activityOrFragment) {
            final T instance = instanceRef.get();
            if( instance==null )
            if( activityOrFragment instanceof Context && !(activityOrFragment instanceof Activity ))
                throw new UnsupportedOperationException("Can't inject fragment into a non-Activity context");
            Object fragment = null;
            try { 
                final InjectFragment injectFragment = (InjectFragment) annotation;
                final int id = injectFragment.value();
                if( id>=0 )
                    fragment = fragmentFindFragmentByIdMethod.invoke(fragmentManagerProvider.get(), id);
Experience pair programming with AI  Get Codota for Java