WebView webView = (WebView)findViewById(R.id.display);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
String path="file:///android_asset/";
String 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.5.min.js'></script>"
+ "</head><body>"
+ "$$x={-b±√{b^2-4ac}}/{2a}$$</body></html>";
webView.loadDataWithBaseURL( "file:///android_asset/" ,js, "text/html", "UTF-8", null);
I added all the files that I downloaded from here in the assets folder but all I get when I run the app is $$x={-b±√{b^2-4ac}}/{2a}$$
instead of the intended equation. Is there anything that I am missing.
Check your path , it is due to the wrong path to your files , i guess you have stored the mathscribe folder in assets , and then you are using this code , you have to modify the path if you have saved the complete folder mathscribe in asset . new path
String path = "file:///android_asset/mathscribe/"
hope this will be helpful ....
js变量中的文件名必须与assets文件夹中的文件名相同。我认为您已下载了最新版本的文件,但从某些旧线程复制并粘贴了代码。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.