Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically change the Spinner's items

I have two spinners. Country and City. I want to dynamically change the City's values upon Country selection. I know how to create and initialize the values of Country but don't know how to set and change the City's values.

Any guidance is appreciated.

UPDATES1 The problem is, I don't have idea on how to update the content of City Spinner. I know listener and other basics on how to create a fixed spinner.

like image 868
eros Avatar asked Jan 19 '23 15:01

eros


1 Answers

For the second spinner, use an Adapter over a List<String> (or whatever your City representation is). After changing the contents of the list, call notifyDataSetChanged on the adapter, and that will do.

like image 161
K-ballo Avatar answered Jan 31 '23 07:01

K-ballo