Q:

Hardcoding Strings in Eclipse

While working on an app, I noticed that whenever I don't use "@string/"...

android:text="@string/stringName"

and just write

android:text="stringName"

Eclipse want's me to add back "@string/". Why is that? What's wrong with hardcoding the string?

A:

You can easily translate your app if you use string resources. For example you can translate it into german, just by putting your string resources into the values-de folder and translating them. Android will then pick the right strings based on the current locale of the phone. It also increases the efficiency of the app.
This is what it can look like:
/values/strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Simple Calculator</string>
    <string name="welcome_message">Welcome!</string>

</resources>

/values-de/strings.xml (german):
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Simpler Taschenrechner</string>
    <string name="welcome_message">Willkommen!</string>

</resources>

Edit:
Just like @EGHDK mentioned; it saves you a lot of time, if you want to change some text. Using string resources you have everything in one place.

