dimanche 28 février 2016

Implementing JqMath Android to display Formulas

I have read about JqMath and how to implement it here at Stackoverflow, but I cannot get it to work correctly.

What I want Display math equations, constants and formulas

What I've done 1. Added these files to my assets folder: jqmath-0.4.3.css jqmath-0.4.3.js jqmath-etc-0.4.3.min.js jquery-1.4.3.js jquery-1.4.3.min.js jscurry-0.4.0.js jscurry-0.4.0.min.js

  1. Written this code:

    private WebView webView;
    private WebSettings webSettings;
    
    //In the constructor
    webView = (WebView) findViewById(R.id.webView);
    webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    path = "file:///android_asset/";
    
    // In the method where I want to set the content
    js = "<html><head>"
            + "<link rel='stylesheet' href='"+path+"jqmath-0.4.3.css'>"
            + "<script src='"+path+"jquery-1.4.3.min.js'></script>"
            + "<script src='"+path+"jqmath-etc-0.4.3.min.js'></script>"
            + "</head><body>"
            + "$$x={-b±√{b^2-4ac}}/{2a}$$</body></html>";
    webView.loadData(js,  "text/html",  "UTF-8");
    
    

The problem According to the logcat:

    E/WifiStateMachine: CMD_START_SCAN : connected mode and no configuration
    4306-4306/com.fredrikandcasper.matteguide I/chromium: [INFO:CONSOLE(1)]                 
    "Not allowed to load local resource: file:///android_asset/jqmath-
    0.4.3.css", source: data:text/html,<html><head><link rel='stylesheet' 
    href='file:///android_asset/jqmath-0.4.3.css'><script 
    src='file:///android_asset/jquery-1.4.3.min.js'></script><script 
    src='file:///android_asset/jqmath-etc-0.4.3.min.js'></script></head>
    <body>$$x={-b%C2%B1%E2%88%9A{b^2-4ac}}/{2a}$$</body></html> (1)

And the same error for the other files: jquery-1.4.3.min.js & jqmath-etc-0.4.3.min.js

How can I solve this?

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire