Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Mathematical parser only returns size2 and not size in Android app

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Mathematical parser only returns size2 and not size in Android app

    Using exp4j which is a mathematical parser twice in one routine (or separated) in Eclipse and only the size2 is calculated when app is run in eclipse. Can someone tell me why? Thanks.

    private void calculate size(){

    String s1 = size.getText().toString();
    String s2 = size2.getText().toString();

    try {
    Calculable result= new ExpressionBuilder(s1).build();
    size1.setText(Double.toString(result.calculate())) ;

    } catch (UnparsableExpressionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    catch(UnknownFunctionException ex) {
    ex.printStackTrace();
    }
    try {
    Calculable result= new ExpressionBuilder(s2).build();
    size2.setText(Double.toString(result.calculate())) ;

    } catch (UnparsableExpressionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    catch(UnknownFunctionException ex) {
    ex.printStackTrace();
    }

    }


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Mathematical parser only returns size2 and not size in Android app

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

Similar Threads

  1. Size of App
    By aussiemcgr in forum Android Development
    Replies: 6
    Last Post: May 2nd, 2013, 01:59 PM
  2. Android Character.getNumericValue returns -1
    By polyfrag in forum Android Development
    Replies: 2
    Last Post: January 24th, 2013, 08:34 AM
  3. Android Camera app
    By Yoyo_Guru in forum Android Development
    Replies: 1
    Last Post: July 26th, 2012, 01:47 PM
  4. Problem developing app for Android
    By jume28 in forum JDBC & Databases
    Replies: 1
    Last Post: June 4th, 2012, 05:26 PM
  5. Hello World Android App
    By TP-Oreilly in forum Android Development
    Replies: 6
    Last Post: January 22nd, 2012, 08:01 PM

Tags for this Thread