Professional Documents
Culture Documents
interface MainFragmentInteractionListener {
fun listItemTapped(list: TaskList)
}
In the companion object, update the newInstance() method to allow the Fragment
to setup itself up with the listener passed in.
The Fragment is setup. Now it's time to set the MainActivity up. Open
MainActivity.kt, then update the class declaration to implement the
MainFragmentInteractionListener interface.
if (savedInstanceState == null) {
val mainFragment = MainFragment.newInstance(this)
supportFragmentManager.beginTransaction()
.replace(R.id.container, mainFragment)
.commitNow()
}