1. Download our Official Android App: Forums for Android!

Apps How to calculate a formula entered into an edittext?

Discussion in 'Android Development' started by nonextstop, Sep 2, 2012.

  1. nonextstop

    nonextstop Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    7
    Joined:
    Oct 20, 2010

    Oct 20, 2010
    7
    0
    5
    Hey,
    I remember seeing a tutorial a few months back that I cant seem to find anywhere :(
    Basically, theres a single EditText, Button, and TextView, and an onClickListener takes the formula that is entered into the EditText (Example: (5^12(6.3+12) / (12 * .01)) ) and it would calculate it and output the answer on the TextView. If anyone can explain how to do this, or link me to the tutorial, it would be greatly appreciated!
    Thanks!
     

    Advertisement

  2. Kostas G

    Kostas G Member
    Rank:
    None
    Points:
    36
    Posts:
    42
    Joined:
    Aug 23, 2012

    I am not aware of the tutorial you are referring to, but what you need is a mathematical parser. Many alternative solutions are discussed in this Stackoverflow question.
     

Share This Page

Loading...