You can use the library jqmath it allows you to use android formulas
Open the following website jqMath and download the JavaScript library. Once you have downloaded the library, copy and paste the folder in the asset folder of your application. If your application does not contain an asset folder, create one first before dropping the plugins to the folder.
First download the library to the site, drop the paste in assets paste:
Iusedthehtmlfile:
<head><metacharset="utf-8">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=UnifrakturMaguntia">
<link rel="stylesheet" href="mathscribe/jqmath-0.4.3.css">
<script src="mathscribe/jquery-1.4.3.min.js"></script>
<script src="mathscribe/jqmath-etc-0.4.3.min.js" charset="utf-8"></script>
<!-- <script>M.MathPlayer = false; M.trustHtml = true;</script> →
</head>
Create a webview with the file:
<RelativeLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="elearning.chidi.com.elearning.FormulaActivity">
<WebView
android:id="@+id/formula_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_above="@+id/more_options"
android:textSize="14sp"
android:textColor="@color/primary_text"
android:background="@color/icons"
android:scrollbars="none" />
</RelativeLayout>
Finally change your activity to call the webview created on the screen:
import android.content.res.AssetManager;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
public class NumberBasicsActivity extends ActionBarActivity {
private WebView articleContent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_number_basics);
Toolbar topToolBar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(topToolBar);
topToolBar.setLogo(R.drawable.logo);
topToolBar.setLogoDescription(getResources().getString(R.string.logo_desc));
articleContent = (WebView) findViewById(R.id.article);
articleContent.getSettings().setJavaScriptEnabled(true);
articleContent.getSettings().setBuiltInZoomControls(true);
try {
articleContent.loadUrl("file:///android_asset/testfile.html");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_number_basics, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
The end result will be:
Source: link