I'm new in kotlin and android development.
I was following a tutorial, in that tutorial in a fragment class, companion object, defined a method named newInstance() that returned a fragment, the method was never used.
class myFragment : Fragment(){
companion object {
fun newInstance(foo:Int): myFragment {
val fragment = myFragment()
val args = Bundle()
args.putString("foo", foo)
fragment.arguments = args
return fragment
}
}
}
Is that okay? Is that going to call it automatically or should I call it somewhere?
(sorry if the explanation isn't good)