如何在Kotlin中实现对Integer数据类型的SetText?
我想从具有整数typedata的Edittext设置数据。如果是字符串,我们可以制作SEATAKE,但是我们如何在Integer上实现它?
警告是否
可以使用所提供的参数调用以下功能。 com.google.android.material.textfield.textinputeDittext中定义的setText(charsequence!) com.google.android.material.textfield.textinputeDittext中定义的setText(int)
The warning is
None of the following functions can be called with the arguments supplied.
setText(CharSequence!) defined in com.google.android.material.textfield.TextInputEditText
setText(Int) defined in com.google.android.material.textfield.TextInputEditText
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的代码显示
数据
是类型userdto
。我不知道该类是什么样的,但是它具有称为Phonenumber
的字段。这就是您传递给setText()
的内容。我无法判断哪种类型phonenumber
是因为您还没有向我们展示userdto
类,但是该错误告诉我们它既不是int
NORCharSequence
,它需要是。您可以尝试这样做才能使它起作用Your code shows
data
is of typeUserDto
. I don't know what that class looks like but it has a field calledphoneNumber
. This is what you are passing tosetText()
. I can't tell what type thisphoneNumber
is because you haven't shown us yourUserDto
class but the error tells us that it's neither anInt
norCharSequence
, which it needs to be. You can try to do this maybe to make it work