Android EditText value to integer

2019-02-19 16:58发布

I am creating a mortgage calculator android program and I was trying to figure out how to get the EditText value (comes back as an Editable) to convert to an integer so I can use those integers in the calculation of the mortgage. I know that there is a toString() method. Would that be the way to go and then try to convert it from a String to an integer?

1条回答
一夜七次
2楼-- · 2019-02-19 17:45
Integer i = Integer.valueOf(String s);

You should also configure the EditText to only accept integer values.

查看更多
登录 后发表回答