Jump to Navigation

Me on Twitter

  • @codinghorror Many thanks @codinghorror it's 17mn that could have been told in 5mn but it's a good demonstration of… https://t.co/d5D5NtGdi2 4 years 13 weeks ago
  • RT @matvelloso: And you think you're a big deal because you can ssh into your container... https://t.co/s4L9yYR6MU 4 years 14 weeks ago
  • Exploring The Raspberry Pi 4 USB-C Issue In-Depth | Hackaday - https://t.co/2Y57LjxOmQ 4 years 14 weeks ago
  • Did I already retweeted that ? "Bad Map Projection: South America" - https://t.co/N3Nr74Y6t3 4 years 14 weeks ago
  • Bad Map Projection: South America - https://t.co/N3Nr74Y6t3 4 years 16 weeks ago
  • It's never too late to learn : very good introduction to #Bluetooth #security and pairing - How Bluetooth works - https://t.co/tru1Jm3kza 4 years 16 weeks ago
  • People who make laws on things they don't understand; just the same all over the world unfortunately - https://t.co/Otc4fkhXi5 4 years 18 weeks ago
  • RT @tewoz: Demain, lancement officiel de ma campagne de crowdfunding pour mon recueil de strips « Comme un Lundi » ! Je compte sur vous pou… 4 years 23 weeks ago
  • Found that in my old CD tower. Noticed the penguin ? Yes it's a #Linux version of #Tribes - Still one of the best g… https://t.co/4QEzHVXhmO 4 years 26 weeks ago
  • RT @esascience: In this #Hubble image, a very distant galaxy – nicknamed the Sunburst Arc – appears at least 12 times 4 years 27 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