1 Replies - 954 Views - Last Post: 18 October 2012 - 04:25 AM

#1 izic  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 197
  • Joined: 15-January 09

Multiple numbers and a result in one EditText

Posted 09 September 2012 - 06:29 PM

Hi, I'm redoing a calculator and want the user to be able to enter multiple numbers in one EditText box instead of using many of them. I also want to display the result in the same box and was wondering if this is possible?

I know the code would look something like this if I wanted to assign a single value to an EditText.
num1=(EditText) findViewById(R.id.cnum1); 


Is This A Good Question/Topic? 0
  • +

Replies To: Multiple numbers and a result in one EditText

#2 jhouns  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 25
  • View blog
  • Posts: 100
  • Joined: 21-December 09

Re: Multiple numbers and a result in one EditText

Posted 18 October 2012 - 04:25 AM

If I'm following you want:
+---------------+
|      52 + 10  |
+---------------+

*presses =*
+---------------+
|           62  |
+---------------+


Yes? If so store the values to variables and then overwrite the textbox with:
tvMyTextView.setText("Result goes here");


or
tvMyTextView.setText(Integer.toString(result));


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1