I know there are a lot of questions like this, but in all of them I did not find any method that would help me.
How are you in activity:
package com.example.guilherme.webviewteste;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webTeste();
}
public void webTeste(){
WebView webView = (WebView) findViewById(R.id.webview1);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
String path="file:///assets/mathscribe/";
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>"+"<script> var s = '$ax^2+bx+c=0$ with $a=0$' M.parseMath(s);document.write(s);</script></body></html>";
webView.loadData(js, "text/html", "UTF-8");
}
}
As in XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.guilherme.webviewteste.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:layout_marginTop="0dp"/>
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview1"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
</WebView>
PrinthowthefinalresultisonyourSmartphone:
The expression on this line should be loaded
var s = '$ ax ^ 2 + bx + c = 0 $ with $ a = 0 $' M.parseMath (s); document.write (s);
Thanks for the help!