How to install jqmath on android?

I'm trying to display some math equations in an android app, but I'm not sure how you use JqMath to display these equations. Can someone tell me step by step what to do to get the simple equations displayed in the Android app? I tried the following:

mEquationWebView = (WebView)v.findViewById(R.id.equation_webView); WebSettings mWebSettings = mEquationWebView.getSettings(); mWebSettings.setJavaScriptEnabled(true); String path="file:///android_asset/"; String js = "<html><head>" + "<link rel='stylesheet' href='file:///android_asset/mathscribe/jqmath-0.4.0.css'>" + "<script src = 'file:///android_asset/mathscribe/jquery-1.4.3.min.js'></script>" + "<script src = 'file:///android_asset/mathscribe/jqmath-etc-0.4.2.min.js'></script>" + "</head><body>" + "<script>var s = '$$x={-b±√{b^2-4ac}}/{2a}$$';M.parseMath(s);document.write(s);</script> </body>"; mEquationWebView.loadDataWithBaseURL("",js,"text/html", "UTF-8", ""); 

And get the following errors: Failed to open resource URL: file: ///android_asset/mathscribe/jqmath-0.4.0.css Failed to open resource URL: file: /// android_asset / mathscribe / jqmath-etc- 0.4.2.min.js Failed to open the resource URL: file: ///android_asset/mathscribe/jquery-1.4.3.min.js

I think the problem may be that I need to upload some jqMath files to my Android files folder, but I'm not sure where to find them.

0
java android jqmath
May 15 '15 at 15:49
source share
1 answer

If you don’t have the files yet, go to http://mathscribe.com/author/jqmath.html and click on the “download jqMath” link in the middle of this page to download jqMath to your computer. Then you will need to put the correct files in your resources folder.

In addition, M.parseMath () should only be applied to a node in the DOM, not a string variable. Your call to M.parseMath(s); here is no-op (does nothing).

You can replace the whole line:

  + "<script>var s = '$$x={-b±√{b^2-4ac}}/{2a}$$';M.parseMath(s);document.write(s);</script> </body>"; 

using only:

  + "$$x={-b±√{b^2-4ac}}/{2a}$$</body></html>"; 
+1
May 16 '15 at 18:16
source share



All Articles