spinner position reference error
Title
Question
I am getting following compilation error. Unresolved Reference: position. How to resolve it?
Android-app-using-Kotlin Adding-spinner-and-Image 05-06 min 0-10 sec
Answers:
Try the below option:
1. Go to File and close project
2. Reopen the same project.
naming error just change position to p2 where p2 is a Int : The position of the view in the adapter
override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
dept=deptList[p2]
Even I got same error for the first time.
Do check that whether you are entering in 'onNothingSelected' or 'onNothingSelected'.
You should enter it in onNothingSelected
Login to add comment