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

3 Answers3

3

double squareRoot = Math.sqrt(100);

Chris
  • 1,180
  • 1
  • 9
  • 17
1

You can do it in this way:

textView.setText(Html.fromHtml("f(x) = ax<sup>2</sup> + bx + c"));
Wojtek
  • 1,210
  • 3
  • 18
  • 23
0

X2 \ "you can make new String for Example"

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 26 '22 at 12:39