I cannot get the spinner to work normally in my fragment. The error I'm getting is "ArrayAdapter function cannot be called" on the ArrayAdapter line.
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
navController = Navigation.findNavController(view)
val list : MutableList<String> = ArrayList()
for (i in 1..1000)
list.add("Item $i")
val adapter :ArrayAdapter<String> = ArrayAdapter(this, R.layout.support_simple_spinner_dropdown_item, list)
spinnerCompany.adapter = adapter
}
Try replacing this
with requireContext()
val adapter : ArrayAdapter<String> = ArrayAdapter(requireContext(), R.layout.support_simple_spinner_dropdown_item, list)