Jump to Navigation

Me on Twitter

  • RT @wselman: I try to not to post too many articles about @firefox but this is the best article I've seen that explains how we are working… 6 years 31 weeks ago
  • RT @MarciRobin: I bought a car today, and the dealership had me check off — with a pen, on paper — that I’m not a robot. https://t.co/x6nJ6… 6 years 32 weeks ago
  • If you want to quickly unregister from #Yahoo #Oath 321 (!) trackers : open browser console (F12) and run `var t=0… https://t.co/qzHuvEXZT0 6 years 33 weeks ago
  • Avis aux connaisseurs ;-) https://t.co/4uEtnV5x2E 6 years 33 weeks ago
  • RT @tewoz: Encore un carnet bien rempli... au suivant !!! #sketchbook #sketchnote #sketch #illustration #happyscribing #scribing #moleskine… 6 years 33 weeks ago
  • Net neutrality. Last chance? https://t.co/nsFcZFQGI7 6 years 34 weeks ago
  • RT @clx_asso_fr: Fête des Libertés Numériques : Données personnelles et droits et libertés (...) https://t.co/HDCLbaj6Xo 6 years 34 weeks ago
  • RT @samuelberthelot: Atelier : Apprenons ensemble à nous déGAFAiser ! - Fête des Libertés Numériques https://t.co/yX5BxApirR via @nuzzel 6 years 34 weeks ago
  • @StackExchange just amazed me again https://t.co/t4PpnhdpY6 6 years 35 weeks ago
  • RT @Numerama: Victime d'un bug, Twitter vous recommande de changer votre mot de passe https://t.co/UlBlW5BzeJ https://t.co/EEfYsx0Oxb 6 years 35 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