Sunday, November 4, 2012

Hardcoded string should use @string resource

Android Development Solution - use @String Resource

Android development Solution
Problem : I'm a beginner android developer , I was trying to run this Linear Layout in eclipse :
Code :
And, I noticed :
1) yellow line under android:text="Yellow"
2) yellow line under android:text="row four"
the Triangle warn says [I18N] Hardcoded string "Yellow", should use @string resource " and same for the rest of the warnings.Any suggestion?

Solution :

It is not good practice to hard code strings into your layout files. You should add them to a string resource file and then reference them from your layout.

This allows you to update every occurrence of the word "Yellow" in all layouts at the same time by just editing your strings.xml file.

It is also extremely useful for supporting multiple languages as a separate strings.xml file can be used for each supported language.

More Android articles :


  1. Hey! I recommend exploring the possibilities of as internationalization tool for Android. It is very useful and open source-friendly. It has github integration, automatic translation and many other useful features.

  2. If you are going for most excellent contents like myself, just pay a visit this web page everyday for the reason that it offers feature contents, thanks

    Here is my web-site: sillas de forja en sevilla (

  3. Hey there! This post could not be written any better! Reading
    through this post reminds me of my old room mate!
    He always kept talking about this. I will forward this post to him.
    Fairly certain he will have a good read. Thanks for sharing!

    Here is my web blog: diy projects for home improvements (

  4. I am genuinely happy to read this web site posts which consists of lots of helpful facts, thanks for providing such data.

    My site ... diy home improvement; ,

  5. Vοus écrivez toujours des postes attractifs

    my webpage films porno amateurs


Thanx for visiting Android Games