0

I want to calculate from 2 input (2 EditText) which the value in EditText receive only int. How to code this?

sean
  • 3,955
  • 21
  • 28
user65544
  • 349
  • 3
  • 9
  • 17

2 Answers2

1

Try adding android:numeric="decimal" to EditText

Prabhat
  • 2,261
  • 7
  • 46
  • 74
0

Use int myInt = Integer.parseInt("55"); Where 55 is the text that was entered in the edittext. If it is an integer in the text it will work; otherwise it will throw NumberFormatException if the string cannot be parsed as an integer value.

w.donahue
  • 10,790
  • 13
  • 56
  • 78