[Q] Converting an editable text box to be used as a integer


Last Updated:

  1. xsxbluexsx

    xsxbluexsx New Member This Topic's Starter

    Joined:
    Oct 17, 2010
    Messages:
    3
    Likes Received:
    0
    I have a edit able text box that is next to a button lets say onclick of the button it will take the text from the editable text box and converted to an integer so it can be subracted by.. oh lets say 32 so my first method was this.

    number = EText.getText();
    textOutcome.setText(number - 32);

    this gave me an error of
    The operator - is undefined for the argument type(s) Editable, int


    my second attempt was
    textOutcome.setText((Integer.parseInt(EText.getText().toString()) - 32));

    This gave me no errors and it ran fine untill i clicked the button which causes the command above to run. and it force closed my application.

    Does any one have any ideas i can do, or any sample code?

    Also yes this is the first time i posted, but this is not the only time. i have knowledge that some people dont and some people have knowledge i dont. but i will be very active. thank you guys.

    Thanks,
    Blue.
     

    Advertisement
  2. xsxbluexsx

    xsxbluexsx New Member This Topic's Starter

    Joined:
    Oct 17, 2010
    Messages:
    3
    Likes Received:
    0
    Resolved..
     

Share This Page

Loading...