Question

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

Was it helpful?

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="\@"/>

OTHER TIPS

//you can also use like this to show special char

Unicode number: U+0040
HTML-code: &#64; 

Little late, but I had the same problem and maybe it will be helpful for somebody.

<EditTextPreference
android:title="@string/pref_char_pares_title"
android:summary="@string/pref_char_pares_summary"
android:key="charseppares"
android:defaultValue="\u0040"/>  
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top