I have id
from API and want to set a generic object having that id in the spinner. Here is my code.
fun selectValue(id: Int?) {
for (index in 0 until spinnerType.count - 1) {
val obj = spinnerType.getItemAtPosition(index) as DropdownMaster
if (obj.typeDetailID == id) {
spinnerType.setSelection(index + 1)
return
}
}
}
This worked fine before making spinner generic.