Android Expj4 check if expression is invalid

view story

http://stackoverflow.com – I am using a library called expj4 on my code http://www.objecthunter.net/exp4j/, everything works fine, but I am having a little problem if I use a expression that gives an error to the evaluation. Example if I use: 2 + 3 * ( 5 + ((36) . In this case I added an extra parenthesis and I would get an error and close the app. What I want to know if there is a way to check if the expression can be evaluated before give the result, so if the expression is wrong I can handle it. Here is the part of the code. Calculable calc = null; try { double varPi = Math.PI; (HowTos)