navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
@SuppressWarnings("ClassNewInstance")
        @NonNull
        public Fragment createFragment(@Nullable Bundle args) {
            Class<? extends Fragment> clazz = getFragmentClass();
            if (clazz == null) {
                throw new IllegalStateException("fragment class not set");
            }

            Fragment f;
            try {
                f = clazz.newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            if (args != null) {
                f.setArguments(args);
            }
            return f;
        }
/**
         * Create a new instance of the {@link Fragment} associated with this destination.
         * @param args optional args to set on the new Fragment
         * @return an instance of the {@link #getFragmentClass() Fragment class} associated
         * with this destination
         */
Create a new instance of the  Fragment associated with this destination.
@param args optional args to set on the new Fragment
@return an instance of the  #getFragmentClass() Fragment class associated
with this destination
Create a new instance of the Fragment associated with this destination . @param args optional args to set on the new Fragment @return an instance of the #getFragmentClass () Fragment class associated with this destination
@SuppressWarnings("ClassNewInstance")
        @NonNull
        public Fragment createFragment(@Nullable Bundle args) {
            Class<? extends Fragment> clazz = getFragmentClass();
            if (clazz == null) {
                throw new IllegalStateException("fragment class not set");
            }
            Fragment f;
            try {
                f = clazz.newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            if (args != null) {
                f.setArguments(args);
            }
            return f;
        }
@ SuppressWarnings ( "ClassNewInstance" ) @ NonNull public Fragment createFragment ( @ Nullable Bundle args ) { Class < ? extends Fragment > clazz = getFragmentClass ( ) ; if ( clazz == null ) { throw new IllegalStateException ( "fragment class not set" ) ; } Fragment f ; try { f = clazz . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } if ( args != null ) { f . setArguments ( args ) ; } return f ; }
Create a new instance of the {@link Fragment} associated with this destination.
Create a new instance of the { @link Fragment } associated with this destination .