问题描述
我在从 EditText
字段获取文本以将其插入到电子邮件编辑器中时遇到问题.我已经在布局文件 (@+id/vnosEmaila) 中声明了 EditText
字段:
I have a problem with getting text from EditText
field to insert it in Email composer with intent. I've declared EditText
field in layout file (@+id/vnosEmaila):
按钮调用 onClick 方法sestaviEmail",我已经声明了它:
The button calls onClick method "sestaviEmail" and I have declared it:
我只是用 Toast 展示它,因为它更快,但每次我尝试从字段中获取文本时,我都会得到假".我发现的所有其他问题的代码都在方法中而不是在布局中声明了 Button,也许这是问题的一部分?
I'm just showing it with Toast because it's faster but everytime I try to get text from field I get "false". All other questions that I've found had code which declared Button in methods and not in layout, maybe this is a part of the problem?
推荐答案
如何从 EditText
获取文本的示例代码.
Sample code for How to get text from EditText
.
Android Java 语法
Kotlin 语法
这篇关于来自 EditText 字段的 Android getText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!