CSAT
CSAT

Reputation: 207

MathJax with TextView in Android

I have some data which was formatted using MathJax on WebApplication. Now, I want to display those Data in Android App and that is in TextView only.

I have already downloaded MathJax from Leathrum's WordPress

I found some examples but all are using WebView. But I want it using TextView. How to get this ???

I am also using ImageGetter with that TextView and it is working fine. Now, just want to do something for MathJax.

Why only TextView ???
My data contains simple text, html text, images, and math functions... I was using webview but it is showing extra space at bottom and also have using with Webview because I am using Custom ListView with WebView

Upvotes: 2

Views: 1688

Answers (2)

TheLittleNaruto
TheLittleNaruto

Reputation: 8473

MathJax is a cross-browser JavaScript library that displays mathematical notation in web browsers, using MathML, LaTeX and ASCIIMathML markup.

Source: MathJax in Wiki

The very first line has an answer for you. It's a cross-browser javascript library. you can not use it for textviews. Doesn't it make sense ?

Update:

Solution 1: You could write a mapper which will have mapping of each Math symbols to its html code and use it to showcase on your TextView based on need.

Solution 2: There is a nice open source: MathView Which is using MathJax internally that you can use.

Upvotes: 2

CommonsWare
CommonsWare

Reputation: 1007409

But I want it using TextView. How to get this ?

You don't. TextView is not designed for this. Your choices are:

  • Stick with WebView

  • Figure out how to render your mathematical expressions to images, then either use an ImageView, ImageSpan, etc.

  • Write your own widget that draws the mathematical expression to a Canvas

Upvotes: 3

Related Questions