Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Converting string to math expression in android

Hey guys,

I wanna convert string to math expression like this: 20+20*50

But I can't import ScriptEngine in android studio.

How can I solve this?

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

John;

Take a look at this post over at stackoverflow. There are some great suggestions and code examples for Java in general but it should point you in the right direction.

Happy coding,

Ken

Thanks for your answer. There isn't ScriptEngineManager class to use it in android.

I found the solution. There's a java class known as Interpreter. You can download this, And import Jar file into your project. http://www.beanshell.org/download.html