summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Raph Levien <raph@google.com> 2015-07-10 17:11:39 -0700
committer Raph Levien <raph@google.com> 2015-07-10 17:44:18 -0700
commitc55277d689dee83f58f63f56a0e26debff62aa56 (patch)
treedbffa0e6eb481ffcdc358f9bf0ab3dc882614962
parent77cae7869dba770f9ec8054b312a29dea8f317f4 (diff)
Improve Html.toHtml() documentation
The existing documentation is very terse and users were getting confused whether the method escapes HTML metacharacters or not. Expand the description a bit and explicitly state that metacharacters are escaped. Bug: 17456925 Change-Id: Icaae7fe1344629de5c0860674f3913781de18013
-rw-r--r--core/java/android/text/Html.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/text/Html.java b/core/java/android/text/Html.java
index a55a08cc73e2..dc1d6f6229c1 100644
--- a/core/java/android/text/Html.java
+++ b/core/java/android/text/Html.java
@@ -137,7 +137,12 @@ public class Html {
}
/**
- * Returns an HTML representation of the provided Spanned text.
+ * Returns an HTML representation of the provided Spanned text. A best effort is
+ * made to add HTML tags corresponding to spans. Also note that HTML metacharacters
+ * (such as "&lt;" and "&amp;") within the input text are escaped.
+ *
+ * @param text input text to convert
+ * @return string containing input converted to HTML
*/
public static String toHtml(Spanned text) {
StringBuilder out = new StringBuilder();