javaandroidandroid-studiotinymce-4wiris

math formula format doesn't appear in android mathView


I am trying to show math formula in my android app I use tiny_mce with WIRIS plugin to write formula as image below enter image description here

the editor store the formula in the database as the following format

<p><math xmlns="http://www.w3.org/1998/Math/MathML"><mroot><mrow><mn>3</mn>
   <mi>x</mi></mrow><mn>2</mn></mroot><mo>&#215;</mo><mn>2</mn>
   <mimathvariant="normal">&#960;</mi></math></p>

I also use MathView in my android app to show this formula as following

 MathView testMathView=(MathView) findViewById(R.id.test);
    testMathView.setText("<p><math xmlns=\"http://www.w3.org/1998/Math/MathML\">" +
          "<mroot><mrow><mn>3</mn><mi>x</mi></mrow><mn>2</mn></mroot>" +
          "<mo>&#215;</mo><mn>2</mn><mi mathvariant=\"normal\">&#960;</mi></math></p>");

but it doesn't work it shows me the only numbers without mathematics formula symbols

here are a GitHub library and tutorial for MathView which doesn't work with outputs of wiris editor MathView on github

could you please give any help or suggestions to show wiris output format in android app?


Solution

  • As I read in docs on GitHub, which you linked, you should set auto:engine="MathJax" in MathView and setText as below:

    testMathView.setText("$$<p><math xmlns=\"http://www.w3.org/1998/Math/MathML\">" +
          "<mroot><mrow><mn>3</mn><mi>x</mi></mrow><mn>2</mn></mroot>" +
          "<mo>&#215;</mo><mn>2</mn><mi mathvariant=\"normal\">&#960;</mi></math></p>$$");
    

    Hope that this will work.