48.8 Implement the OnFragmentInteractionListener
Before adding code to trigger the action, the MainActivity class will need to be modified to implement the OnFragmentInteractionListener interface. This is an interface that was generated within the SecondFragment class when the blank fragment was created within the navigation graph editor. In order to conform to the interface, the activity needs to implement a single method named onFragmentInteraction() and is used to implement communication between the fragment and the activity.
Edit the MainActivity.kt file and modify it so that it reads as follows:
.
.
import android.net.Uri
.
.
class MainActivity : AppCompatActivity(),
SecondFragment.OnFragmentInteractionListener {
override fun onCreate(savedInstanceState: Bundle?) {
...