在 edittext 中设置文本时出错
我设置了两个编辑文本字段和一个按钮。这个想法是如果我输入任何内容 在其中一个文本字段中,按下按钮,必须在文本字段中设置确切的值 其他领域。这是我的代码。
rf1.setText("" + rf2);
但是当我运行程序时(输入 24,按下按钮),另一个文本字段中会显示一条奇怪的消息:
“android.widget.EditText......废话。
有什么想法吗??
I've set up two edittext fields and a button. The idea is if I key in anything
in one of the text fields, press the button the exact value must be set in the
other field. Here 's my code.
rf1.setText("" + rf2);
But when I run the program (input say 24, press button) a strange message is displyed in the other text field saying
"android.widget.EditText.....blah.
Any ideas anyone ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设 rf1 和 rf2 是您的
EditText
字段,则在设置文本之前不会将其转换为字符串。试试这个:
然后使用
setText()
Assuming that rf1 and rf2 are your
EditText
fields, you are not converting it to a string before setting the text.Try this:
Then use
setText()