I made 3 dropDown Spinners and made Spinner Adapters and did setAdapters for each Spinner. But the problem is that when I click on the dropdown Spinner item, I call from the getView of Spinner Adapters to another Spinner, but I don't know why.
private fun initSeriesSpinner() {
val series = resources.getStringArray(R.array.selectedSeriesList)
val listOfSeries = ArrayList(mutableListOf(*series))
spinnerSeriesAdapter =
MonkeySpinnerViewAdapter(requireContext(), 0, listOfSeries)
binding.spinnerSeries.adapter = spinnerSeriesAdapter
}
private fun initTypeSpinner() {
val types = resources.getStringArray(R.array.selectedSeriesList)
val listOfSeries = ArrayList(mutableListOf(*types))
with(binding) {
spinnerType.buildCheckedSpinner(listOfSeries) { selectedPositionList, displayString ->
}
}
}
private fun initCompareSpinner() {
val types = resources.getStringArray(R.array.testList)
val listOfSeries = ArrayList(mutableListOf(*types))
binding.spinnerCompare.adapter = MonkeySpinnerViewAdapter(requireContext(), 0, listOfSeries)
}
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val binding: ItemMultiSpinnerGetviewBinding = if (convertView == null) {
/*Log.d("TEST","check_getView")
Log.d("TEST","position = $position")*/
Log.d("TESt","> // hashCode = ${this.hashCode()}")
ItemMultiSpinnerGetviewBinding.inflate(LayoutInflater.from(context), parent, false)
.also {
it.root.tag = it
}
} else {
convertView.tag as ItemMultiSpinnerGetviewBinding
}
binding.tvBeforeClickedMultiSpinner.text = dataList[position].text
return binding.root
}
below code is in getDropDownView
if (isDataChanged) {
checkedListener(dataList, position)
notifyDataSetChanged()
}
The way I tried to solve it was because the resource file was the same, so I made a new array object and put it in, and I thought it was because I used the same Spinner Adapter class, so I made a separate class, but it was called together.