I am new to android development.
I want to concatenate (Add a string to each item in an array list) and set it to my spinner
I have 2 arrays:
Array 1 = { Item1, Item2, Item3, Item4 }
Array 2 = { A, B, C, D }
So I am setting only Array1 in spinner like this:
ArrayAdapter(requireContext(), R.layout.spn_item_selected, Array1)
Right now, this is what is displayed in the spinner:
Item1
Item2
Item3
Item4
How do I add items in array 2 to the items in array 1 so I can display something like this in the spinner
Item1, A
Item2, B
Item3, C
Item4, D
For a string I could do this:
val a = "Hello"
val b = "Baeldung"
val c = a + " " + b
//result
Hello Baeldung
But this is an array all gotten from a backend
Sorry if this may be simple, I have searched but didnt find what I'm looking for.