I'm trying to write email address with @ character inside the xml using TextView. I tried using Unicode like someone suggested in the other post asking about '&' character. It didn't work for @. I tried
<string name="gmail">\u0040 gmail.com</string>
but that returns java.lang.ArrayIndexOutOfBoundsException.
I also tried
<string name="gmail" formatted="false">@gmail.com</string>
but it still gives the same error.
I have no idea how to go about this problem. Please Help!!
This should do the trick:
<string name="gmail">\@ gmail.com</string>
@ is, of course, the way you reference identified resources (@+id\\textview) which requires escaping to use.
Pretty sure that formatted="false" does not flag Android to avoid looking up identifiers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.