I have buttons that write into a textview. I want to write "?", but it's not allowed in strings.xml. So, I want the button to have different value (which is written to the textview) than the text in the button. How can I do this? Thanks in advance.
Asked
Active
Viewed 92 times
0
-
what do you want to do? – Blackbelt Mar 11 '14 at 16:14
-
I want to write "?" to a textview with a button. – Tamas Koos Mar 11 '14 at 16:16
-
did you already wrote some code? Would you like to share it ? – Blackbelt Mar 11 '14 at 16:19
-
? is allowed in strings.xml – KitAndKat Mar 11 '14 at 16:20
-
No it says "error: Error: Resource id cannot be an empty string (at 'buttonq' with value '?')." – Tamas Koos Mar 11 '14 at 16:24
-
@KitAndKat : not in first position, as it is interpreted as designing an id `?string/bla` – njzk2 Mar 11 '14 at 16:25
2 Answers
3
Use
<string name="question">\?</string>
to escape the question mark.

Diego Torres Milano
- 65,697
- 9
- 111
- 134
0
Also , you can try Html.fromHtml programmatically. Following link discusses that. android-TextView setText in Html.fromHtml to display image and text
Thanks JRH