For an Android app, I have the following functionality
private ArrayList _categories; // eg [\"horses\",\"camels\"[,etc]] private int getCateg
the best solution here
class Category(var Id: Int,var Name: String) arrayList is Category list val selectedPositon=arrayList.map { x->x.Id }.indexOf(Category_Id) spinner_update_categories.setSelection(selectedPositon)