-1

Calling an intent with onClick Listener from an activity is not a problem, but the same code in a fragment throws an unrechable code error in Intent that says none of its constructors can be called with these parameters. Here's my code:

class FragEqCrew : Fragment() {

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                          savedInstanceState: Bundle?): View? {
    // Inflate the layout for this fragment
    return inflater.inflate(R.layout.frag_eq_crew, container, false)

    eq_row.setOnClickListener(({
        var clickintent = Intent(this@FragEqCrew, Equipment::class.java)
        startActivity(clickintent)

    }))

}
}

1 Answers1

2

This is because you have added return statement in starting. That's why code after return is unreachable.

Parul
  • 387
  • 1
  • 5