Charles
Charles

Reputation: 1229

No resource found that matches the given name (string)

In one of my layouts I need a string:

<TextView
    android:id="@+id/textViewReso"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@strings/settings_reso" />

but Eclipse tells me

No resource found that matches the given name (at 'text' with value '@strings/settings_reso')

However, here's my res/values/strings.xml file:

<?xml version="1.0" encoding="utf-8"?>

<resources>

    <string name="app_name">Crono</string>

    <string name="wallpaper_description">Fond d\'écran Crono</string>

    <string name="settings_enable_text">Activer l\'écran de veille</string>
    <string name="settings_output_text">Sortie son haut-parleur \?</string>
    <string name="settings_gallery">Galerie</string>
    <string name="settings_reso">Résolution : HD/SD</string>
    <string name= "settings_force">"Forcer la mise à jour des contenus"</string> 
    <string name="settings_time_text">Temps entre les vidéos (s)</string>
    <string name="settings_server_text">Adresse du serveur</string>

</resources>

So actually there IS such a resource! Now why isn't it generated my R file? Is is because of the French characters?

Upvotes: 2

Views: 6611

Answers (3)

Kanwaljit Singh
Kanwaljit Singh

Reputation: 4377

Try this:

<TextView
        android:id="@+id/textViewReso"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/settings_reso" />

Just change @strings to @string in your layout xml file.

Upvotes: 4

Charles
Charles

Reputation: 1229

The reference keyword for a string is @string and not @strings (notice the 's'). So in my layout it should read :

android:text="@string/settings_reso" />

and not :

android:text="@strings/settings_reso" />

Pretty dumb, but pretty invisible.

Upvotes: 2

rosorio
rosorio

Reputation: 321

You have to change @strings to @string in your layout xml file!

android:text="@string/settings_reso"

<TextView
android:id="@+id/textViewReso"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/settings_reso" />

Upvotes: 2

Related Questions