title: How to use FragmentFactory with arguments at runtime?
body: <p>Let's say i have a fragment with constructor that gets an argument at runtime depending on a network request for instance</p>
  <pre><code>class MyFragment(private val myArg: Int) : Fragment() {
     // Do layout and other stuff
  }
  </code></pre>
  <p>I did a sample FragmentFactory to pass but my question is is there a better way to pass arguments especially when we have various fragments that need arguments in runtime?</p>
  <pre><code>class MyFragmentFactory private constructor() : FragmentFactory() {
  
      var myArg = 0
  
      override fun instantiate(classLoader: ClassLoader, className: String): Fragment {
  
          return when (className) {
              MyFragment::class.java.name -&gt; MyFragment(myArg)
              else -&gt; super.instantiate(classLoader, className)
          }
      }
  }
  </code></pre>
  <p>There is a method of FragmentManager class</p>
  <pre><code>  public final FragmentTransaction replace(@IdRes int containerViewId,
          @NonNull Class&lt;? extends Fragment&gt; fragmentClass, @Nullable Bundle args) {
      return replace(containerViewId, fragmentClass, args, null);
  }
  </code></pre>
  <p>how is this method used and can it be used with FragmentFactory, and how are arguments passed to the fragment using this method?</p>