Because Fragment
is NOT of Context
type, you’ll need to call the parent Activity
:
val intent = Intent (getActivity(), Main::class.java)
getActivity().startActivity(intent)
or maybe something like
activity?.let{
val intent = Intent (it, Main::class.java)
it.startActivity(intent)
}