Posts

Showing posts with the label android-arrayadapter

Adding new element(s) to Spinner Adapter

Adding new element(s) to Spinner Adapter I'm new to Kotlin language and I'm going to load Spinner data from the website. For this reason, I used Fuel Library as my httpGet , httpPost and ... helper library and simply the Spinner Control for showing that data to the user. Below is my tried code: Kotlin Spinner httpGet httpPost Spinner var listOfLesson:List<String> = listOf() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.ostad_page) val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, listOfLesson) "home/GetAllLessons".httpGet().responseString { request, response, result -> when (result) { is Result.Success -> { val lessonsArray: List<tblLesson> = Gson().fromJson(result.value, Array<tblLesson>::class.java).toList() var index:Int = 0 for (lesson: tblLesso...