I'm quite new to Android and I'm trying to display some chemical formulas in a textView which is contained in a customListView. I'm fetching all datas from xml parsing, then I wish to display the formula, such as C₉H₈O₄. But I can see only 1-4 digits.
I'm converting from "normal" to "subscript" in this way
str = str.replaceAll("0", "\u2080");
str = str.replaceAll("1", "\u2081");
str = str.replaceAll("2", "\u2082");
str = str.replaceAll("3", "\u2083");
str = str.replaceAll("4", "\u2084");
str = str.replaceAll("5", "\u2085");
str = str.replaceAll("6", "\u2086");
str = str.replaceAll("7", "\u2087");
str = str.replaceAll("8", "\u2088");
str = str.replaceAll("9", "\u2089");
str contains the formula fetched from the xml file.
The strange behavior is that I can see in the Logcat the formula as it should be.
I also tried with customs fonts but nothing.
Here are two results: the first is with normal font, the second with a custom one
https://www.dropbox.com/s/jyk64p700up14db/cella.jpg https://www.dropbox.com/s/ab9h1b45j2hrods/Schermata%2003-2456370%20alle%2022.05.45.png
Over the web I can read as a solution using something like
setText(Html.fromHtml("X<sub>2</sub>
"));
but I really don't know how to use it in my case.
Any suggestion?