Android版的EditText值整数 [英] Android EditText value to integer
本文介绍了Android版的EditText值整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建抵押计算器Android程序,我是想弄清楚如何获得的EditText值(回来为可编辑),以转换为整数,所以我可以在抵押贷款的计算中使用的整数。我知道,有一个toString()方法。请问这是否去,然后尝试将它从字符串转换为整数的方式?
解决方案
整数i = Integer.valueOf(String s)将;
您还应该配置的EditText只接受整数值。
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?
解决方案
Integer i = Integer.valueOf(String s);
You should also configure the EditText to only accept integer values.
这篇关于Android版的EditText值整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文