Jump to Navigation

Me on Twitter

  • @Delicious Android app does not launch anymore (since 5.1 OTA update, looks like). I've sent bug reports, are u working on it ? 9 years 36 weeks ago
  • @Groomboxfr appli introuvable sur #GoolePlay 9 years 36 weeks ago
  • #FirefoxHello Video chat without account : hope it's gonna be the standard ! https://t.co/0ChutMrHsN 9 years 45 weeks ago
  • RT @initializr: http://t.co/Hrgl0bZGlW is now serving H5BP 5.0! 9 years 48 weeks ago
  • APIs should not be copyrightable. No comment. http://t.co/Ke2OnStFSX 10 years 2 weeks ago
  • Just got a "retry in 20s" toast on the lock screen for the 1st time. Looks linked 2 #lollipop bug fixes http://t.co/n0juzwaQ4H 10 years 3 weeks ago
  • @nic0b0 Ha ! Finally.. #android5.0.1 up and running. Let's see what's new... 10 years 3 weeks ago
  • Just seen an #Android5.0.1 update notification on my phone then... nothing... ??? 10 years 4 weeks ago
  • Looks like there's going to be an #Android5.1 "#Lollipop fails: the 5 worst things about #Android 5.0" http://t.co/xa54ShFaLw 10 years 6 weeks ago
  • #YotaPhone2 Definitely sexy phone http://t.co/CLV30ntTkl 10 years 6 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