Jump to Navigation

Me on Twitter

  • RT @computerfact: concerned parent: if all your friends jumped off a bridge would you follow them? machine learning algorithm: yes. 6 years 42 weeks ago
  • RT @timberners_lee: We have lost a colossal mind and a wonderful spirit. Rest in peace, Stephen Hawking. https://t.co/ectv7r4UIm 6 years 43 weeks ago
  • RT @helenvholmes: Yes, let's https://t.co/tM4iF50idY 6 years 47 weeks ago
  • Do people who can afford a LG wallpaper TV really care about paying it 7,999.99$ rather than 8,000$ ??? 7 years 7 weeks ago
  • As I understand this is 1 step closer to breaking current cryptography standards. Goodbye #privacy https://t.co/ncka6ldRV8 #quantumcomputing 7 years 8 weeks ago
  • Write 'cookie' in Unicode : 7 years 11 weeks ago
  • RT @FBonnifet: Un peu de pédagogie pour tous ceux qui n'ont pas compris l'intérêt d'une taxe carbone 7 years 13 weeks ago
  • @laquadrature Google sometimes frightens me. It just looked into my photos to suggest me a better look for my last… https://t.co/kGT8dnmVDb 7 years 13 weeks ago
  • "Voici les quatre mesures qui menacent notre vie privée" https://t.co/I6spzN5QKB 7 years 13 weeks ago
  • RT @datagouvfr: Service public de la donnée: les données du Cadastre sont maintenant disponibles en #opendata: https://t.co/BNfYwaFRhp http… 7 years 14 weeks ago

XML resources

android How to organise XML resources

The first time I read Android developer docs, there was something that was unclear to me : what resource to put in which XML file.

In this article, I will focus on resources in res/values and give some hints about how to name your XML resource files and what kind of resource to put inside.

...

In my case I had only one or two arrays of strings so it was overwhelming to put them in a separate file just because they were of a different type.

Another problem was accessing constant values from both XML layout and Java code. They are constant strings for internal use only, but in order to avoid duplicate declarations I decided to make them available as XML resources. I wanted those resources to be clearly separated from other, 'user visible', resources like GUI labels.

Another thing adding to the fog was the fact that, in derivate files (e.g. strings-fr.xml is derivated from strings.xml), you only want to find values relevant for the given file.
For instance, if you put all values of type 'string' in the same file but only a part of them should be internationalized, you would have a gap between the original and derivated files not only by the translated values but also by the list of values they declare. When coming back to the project after a long time, you might have a hard time remembering why there is this gap.

...

Syndicate content