stranger
stranger

Reputation: 13

android textview not supporting symbols

<string name="feat"> * Good User Interface \n * Fast Searching \n * Text To Speech \n * Simple Interface & Offline \n * Low Memory Usage \n * Favourites option \n * Login Option \n * Social Network Link \n * Sharing Application Option </string>

this is the statement got error. The error is "The entity name must immediately follow the '&' in the entity reference.'

Upvotes: 0

Views: 169

Answers (3)

Anirudh Sharma
Anirudh Sharma

Reputation: 7974

While the above solutions will work Another good solution can be to enclose your string resource in CDATA tag like:

<string name="feat"><![CDATA[ * Good User Interface \n * Fast Searching \n * Text To Speech \n * Simple Interface & Offline \n * Low Memory Usage \n * Favourites option \n * Login Option \n * Social Network Link \n * Sharing Application Option ]]></string>

This way it will be easy as you won't have to replace each and every & with &amp; which is tedious task.This may work with all special characters i guess(not tested).

Upvotes: 1

King of Masses
King of Masses

Reputation: 18775

My guess is that your XML datasource contains '&' character in some data.

If so replace '&' with &amp; and try, it should work properly.

In Additional to it, Some of other Common in xml how to escape the errors:

  • ampersand (&) is escaped to &
  • double quotes (") are escaped to "
  • single quotes (') are escaped to '
  • less than (<) is escaped to . <
  • greater than (>) is escaped to . >

Upvotes: 1

Sagar Zala
Sagar Zala

Reputation: 5134

Use &amp; in place of & symbol.

Upvotes: 1

Related Questions