[Closed] Converting Text into an Integer?
Im sure this is a easy problem for you guys to solve, but how do I convert text from a edittext box into an integer to be read as numbers?
For example, here is my code:
edittext txtNthFrame “Every Nth Frame:” FieldWidth:30 pos:[10, 120]
rendNThFrame = txtNthFrame
The error message Im getting is that the rendNthFrame is not a integer, even when I enter a number into the edittext box. What variable am I missing or can use to convert the edittext box to read as a integer and not text??
Thanks!
Hi ! you probably should use a spinner for that.
but to convert text, you can use the ‘as’ keyword.
rendNThFrame = txtNthFrame.text as integer
Alternatively, consider using a spinner for the value, text fields are not very useful for number entry as the user could enter ANYTHING and crash the code unless you tested to make sure the string entered IS a number…