Open PareshMayani opened 9 years ago
@PareshMayani I quite like this idea. Honestly I didn't know this was possible to do. I will make these changes for sure. Might take some time but will get to it. Thanks for sharing!
Keep the current lists as same, just add a single list with all the details belonging to the particular country!
@vinaygaba @PareshMayani
The problem to go with the above pattern is, it removes the simplicity of using string-array
and switches to use of XML Parsers
.
This point is about to optimize the code you are using. Instead of referring to two or more different lists separately, there should be a single list contains all the items and each item should contain code, name, ID, language, etc. details (i.e. required details)
Yes the current solution which is like preparing an arraylist of string directly is best, but it's a good solution when you are getting values from different array lists, because by change if someone or you delete an item from a particular list then items count won't be matched and so loop break!
Current:
Optimized solution:
And solution should be like parsing XML and preparing list of objects. More details: http://stackoverflow.com/questions/9568700/android-resource-an-array-to-store-country-name-country-code