In my app, for localization I have a values-ar
folder for arabic strings. The problem is that the arabic alphabet appears unconnected in phones which do not have Arabic language installed. I'm using the ArabicReshape class to join the arabic alphabets but since I have too many strings, I cannot manually keep applying the reshaper class one by one.
I would like to know if I can get all the strings from the strings.xml
file and apply the class to the strings at one go by looping through them. Is this possible?
I don't understand why you need to iterate thrtough ALL strings instead of calling the class when you need one specific string.
But as you asked...
I guess this might help you ;-)
Field[] fields = R.string.class.getFields();
for(final Field field : fields) {
String name = field.getName(); //name of string
try{
int id = field.getInt(R.string.class); //id of string
}catch (Exception ex) {
//do smth
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With