Search code examples
androidxmlpreferences

Including especial characters in android preferences.xml


I want to include an item in my preferences.xml file that it contains a special character @.

           <EditTextPreference
            android:title="@string/pref_char_pares_title"
            android:summary="@string/pref_char_pares_summary"
            android:key="charseppares"
            android:defaultValue="@"/>      

But I have an error in line android:defaultValue="@"

(error: Error: No resource type specified (at 'defaultValue' with value '@').

I want to use the character @ like separator character in my strings. Thanks in Advance


Solution

  • Can you try this

      <EditTextPreference
                android:title="@string/pref_char_pares_title"
                android:summary="@string/pref_char_pares_summary"
                android:key="charseppares"
                android:defaultValue="\@"/>