Combinations for every x and y items in Spinners Android -
i have 2 spinners items dynamic i.e, there can 'n' number of items in both spinners. want possible combinations of every items both spinners.
suppose there a1,a2 items in spinner1 , b1,b2,b3 items in spinner2 want combination of item a1 , a2 spinner1 items of spinner2 i.e, a1b1, a1b2, a1b3 , a2b1,a2b2,a2b3. how can achieve that?
suppose first spinner1 data in list1.
list<string> spinner1 = new arraylist<string>(); spinner1.add(a1); spinner1.add(a2);
and spinner2 data in list2.
list<string> spinner2 = new arraylist<string>(); spinner2.add(b1); spinner2.add(b2); spinner2.add(b3); list<string> finaldata = new arraylist<string>();
now final spinner data,
for(string s1 : spinner1){ for(string s2 : spinner2){ string str = s1.concat(s2); finaldata.add(str); } }
Comments
Post a Comment