片段绑定上选定项目的问题

Problem with selected Item on fragment binding

我正在尝试制作一个指示所选项目的 Toast,所以我使用了它,但是当我 运行 应用程序关闭时。你知道这样做的正确方法吗?谢谢

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    binding = FragmentPrimerBinding.bind(view)
    val arrayAdapter : ArrayAdapter<*>
    val tableros = mutableListOf("3x4","3x7","3x8","3x9","3x10","4x5","4x6","4x7","4x8","4x9","5x5","5x6","5x7","5x8","5x9").toList()

    arrayAdapter = context?.let { ArrayAdapter(it.applicationContext,android.R.layout.simple_list_item_1,tableros) }!!
    binding.listview.adapter = arrayAdapter

    binding.listview.setOnItemClickListener{parent, view, position, id ->
        Toast.makeText(requireContext().applicationContext,binding.listview.selectedItem.toString(),Toast.LENGTH_LONG).show()
    }

}

好吧,使用“位置”是解决方案 :) 我希望它对任何人都有帮助