1. Are you ready for the Galaxy S20? Here is everything we know so far!

need help on division and displaying the value

Discussion in 'Android Development' started by currycrab, Sep 15, 2011.

  1. currycrab

    currycrab Newbie
    Thread Starter

    when i press calculate. it crash. it looks like there is some problem displaying the result of the division. hope anyone who encountered this problem can help me. thanks alot in advance.


    Code (Text):
    1. protected void showResult(Editable first, Editable second, Editable third,
    2.                               Editable forth, Editable fifth, Editable sixth)
    3.     {
    4.     float num1 = Float.parseFloat(first.toString());
    5.     float num2 = Float.parseFloat(second.toString());
    6.     float num3 = Float.parseFloat(third.toString());
    7.     float num4 = Float.parseFloat(forth.toString());
    8.     float num5 = Float.parseFloat(fifth.toString());
    9.     float num6 = Float.parseFloat(sixth.toString());
    10.     float resultModuleCredits = num1 + num2 + num3;
    11.     float resultGPA = num4 + num5 + num6;
    12.     double result = (resultModuleCredits * resultGPA)/resultModuleCredits;
    13.     Result.setText(String.valueOf(result));
    14.  
    15.  
    16.     }
     



    1. Download the Forums for Android™ app!


      Download

       
  2. jonbonazza

    jonbonazza Android Expert

    Can we see some logcat output?
     
  3. currycrab

    currycrab Newbie
    Thread Starter

    thanks bro. manage to solved it. im blinded =.= because the value in the text field is empty hence the application crashed thanks.
     
Loading...

Share This Page

Loading...