How to display math formula, stored in an arraylist?

0 votes
asked by about Android Studio
edited by

I am making a math quiz where a mathematical question will be asked in the form of a formula. I put my questions in an ArrayList:

ArrayList<ArrayList<String>> quizArray = new ArrayList<>();
    String quizData[][] = {
            {"x^2", "1", "0", "x", "-1"},
            {"x^2", "5", "x", "5x-2", "1"},
            {"0", "0", "x", "e", "-1"},
            {"x+1", "5", "x", "5x-2", "1"},
            {"3", "1", "0", "x", "-1"},
            {"642", "34", "97", "5x-2", "1"}
    };

As you can see I tried to make the formula x^2, this will not be shown as x with a small exponent 2 but as x^2. This x^2 is not what I want. How can I used for example html in this arraylist to achieve this goal? Or is there another way?

1 Answer

0 votes
No avatar answered by (329k points)

There are many ways you can display math formulas in Android Studio and practically in any application that you develop. There are modules that parse your input and display the formula exactly as they have to be.

For example, you can use MathView and its source code to display the formula correctly in Android Studio.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...