如何从一个EditText上获得多个变量? [英] How to get multiple variables from one EditText?

查看:142
本文介绍了如何从一个EditText上获得多个变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方式来获得从一个EditText.I've看着开发商页的三个浮点值,但我不能找到任何最适合我的need.I想拿到三花车斧,Y,Z从EditText上的一个项目?

感谢你们的回信O此问题IM真的greatfull这么多。
进出口仅限于我的计算机上的时间,但现在生病让你知道哪些回答为我工作和生病后我的code了。


解决方案

 字符串值= yourEditText.getText()的toString();
串[] floatStrings = value.split(,);
浮动[]结果=新的浮动[floatString.length]
的for(int i = 0; I< result.length;我++){
    结果[I] = Float.valueOf(floatStrings [I]
}

I'm looking for a way to get three float values from one EditText.I've Looked of the developers page but i couldnt find anything that best fit my need.I would like to get three floats a x,y,z from one entry of EditText?

Thank you guys so much on the replys o this Question im really greatfull. Im limited to the time on my computer right now but ill let you know which answer work for me and ill post my code too.

解决方案

String value = yourEditText.getText().toString();
String[] floatStrings = value.split(",");
float[] result = new float[floatString.length];
for (int i=0; i<result.length; i++) {
    result[i] = Float.valueOf(floatStrings[i];
}

?

这篇关于如何从一个EditText上获得多个变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆