2

What's the best practice to make a square root function in android in text form (ex. Quadratic equation). Could I do it in HTML in my XML file possibly? Or would have have to do it under java

user4914918
  • 91
  • 1
  • 3
  • 10
  • To clarify, are you trying to show the √ symbol in text, or perform a square root operation on a number? – emerssso Oct 01 '15 at 19:34
  • I'm assuming you want to *display* a square root symbol (Hint: You might want to edit the question to make this clearer). You might want to also start reading [MathML and Java](https://stackoverflow.com/questions/1784786/mathml-and-java). Android can't do MathML (chrome doesn't support it, either). – dhke Oct 01 '15 at 19:37
  • I want to show it in text format. Say like the quadratic equation, that's something I'd like to write in text form in a stacked fraction. – user4914918 Oct 01 '15 at 19:38

2 Answers2

4

double squareRoot = Math.sqrt(100);

Chris
  • 1,137
  • 1
  • 8
  • 13
0

You can do it in this way:

textView.setText(Html.fromHtml("f(x) = ax<sup>2</sup> + bx + c"));
Wojtek
  • 1,040
  • 2
  • 16
  • 22