Android Question 1+4+15 calc math in EditText

Mark Stuart

Active Member
Licensed User
Longtime User
Hi y'all,

I want to give users a feature that allows them to input numbers into an EditText view and then with a button calculate - add up - the numbers that were input.
Example: 1+4+15
The result obviously would equal 20 with the push of the button.

How it Would Work:
The user would have to type in the numbers and the plus (+) character, and end/finish with a number.
Then when ready to add up the numbers, they would press a button. The button code would have to some how calculate the numbers.

That's where I'm thinking there must be a Math library some where that parses the text, turns it into an equation and adds it to get a result.

Anyone aware of such a library, java, or B4X code that can do that?

Regards,
Mark Stuart
 

aeric

Expert
Licensed User
Longtime User
Yes.
Check this:
 
Upvote 1

Mark Stuart

Active Member
Licensed User
Longtime User
I'm giving ChatGPT my request. So far it seems possible to do it all with B4X code.
Even typing on the go or with a button to give a calculation.

I'll post the results after testing the code.

I'm just needing simple addition for my situation. No other math function needed.
 
Upvote 0
Top