Answers for "newinstance fragment kotlin"

1

newinstance fragment kotlin

class NameOfFragment : Fragment() {

  companion object {
    // new instance pattern for fragment
    @JvmStatic
    fun newInstance(): NameOfFragment {
      val nameOfFragment = NameOfFragment()
      val args = Bundle()
      nameOfFragment.arguments = args
      return nameOfFragment
    }
  }
  
 //Initial fragment
override fun getInitialFragment(): Fragment {
  return NameOfFragment.newInstance()
}
Posted by: Guest on January-13-2021

Code answers related to "newinstance fragment kotlin"

Browse Popular Code Answers by Language