I am making a calculator in Android.
For this purpose I am using various buttons, three of which are for the symbol of PI, square root and cube root.
Now when I test this as a simple code in netbeans:
public class Test {
public static void main(String[] args) {
System.out.println("\u03C0");
System.out.println("\u221A");
System.out.println("\u221B");
}
}
I get the expected output:
run:
π
√
∛
However when I do similar display for android development using eclipse:
public static String[] button_text = new String[]{
"^", "ln(", "log(", "\u221A(",
"\u03C0", "x!", "abs(", "\u221B("
};
public static String[] button_text_values = new String[]{
"^", "ln(", "log(", "\u221A(",
"\u03C0", "!", "abs(", "\u221B("
};
The buttons pi, sqrt do display the symbol. On pressing them, the symbols also appear in the textview.
However the same does not hold for the cube root button. It just displays the bracker “(“.
On pressing it the textview also displays only the bracket.
However all calculations go correct.
That is pressing cuberoot and then 8 does give the result 2.
This means the cuberoot does exist in the expression string, but is not being displayed in buttons or the textview.
How do I correct it?
Thank you.
The font you are using probably does not contain the cube root character. Try a different font:
Also see this:
http://tinkering-is-fun.blogspot.co.uk/2012/04/adding-support-for-more-characters-in.html