• <bdo id='sdg1r'></bdo><ul id='sdg1r'></ul>
    <i id='sdg1r'><tr id='sdg1r'><dt id='sdg1r'><q id='sdg1r'><span id='sdg1r'><b id='sdg1r'><form id='sdg1r'><ins id='sdg1r'></ins><ul id='sdg1r'></ul><sub id='sdg1r'></sub></form><legend id='sdg1r'></legend><bdo id='sdg1r'><pre id='sdg1r'><center id='sdg1r'></center></pre></bdo></b><th id='sdg1r'></th></span></q></dt></tr></i><div id='sdg1r'><tfoot id='sdg1r'></tfoot><dl id='sdg1r'><fieldset id='sdg1r'></fieldset></dl></div>

      <legend id='sdg1r'><style id='sdg1r'><dir id='sdg1r'><q id='sdg1r'></q></dir></style></legend>
      1. <small id='sdg1r'></small><noframes id='sdg1r'>

      2. <tfoot id='sdg1r'></tfoot>

        在 Android 项目中使用 EditText.toString() 方法获取奇怪的文本.为什么?

        Getting weird text back with EditText.toString() method in Android project. Why?(在 Android 项目中使用 EditText.toString() 方法获取奇怪的文本.为什么?)

        <small id='rASya'></small><noframes id='rASya'>

        <legend id='rASya'><style id='rASya'><dir id='rASya'><q id='rASya'></q></dir></style></legend>
          <bdo id='rASya'></bdo><ul id='rASya'></ul>
              <tbody id='rASya'></tbody>

                <i id='rASya'><tr id='rASya'><dt id='rASya'><q id='rASya'><span id='rASya'><b id='rASya'><form id='rASya'><ins id='rASya'></ins><ul id='rASya'></ul><sub id='rASya'></sub></form><legend id='rASya'></legend><bdo id='rASya'><pre id='rASya'><center id='rASya'></center></pre></bdo></b><th id='rASya'></th></span></q></dt></tr></i><div id='rASya'><tfoot id='rASya'></tfoot><dl id='rASya'><fieldset id='rASya'></fieldset></dl></div>

                • <tfoot id='rASya'></tfoot>
                  本文介绍了在 Android 项目中使用 EditText.toString() 方法获取奇怪的文本.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对 EditText 对象的理解似乎存在根本性的差距.我有一个带有单个 EditText 对象的 Activity+Layout.在我在 EditText 对象中键入几个字符并按 Enter 键后,我在我的 onKey() 侦听器中检索文本.当我使用 toString() 方法检索文本时,我得到一个奇怪的字符串,例如:

                  I appear to have a fundamental gap in my understanding of an EditText object. I have an Activity+Layout with a single EditText object. After I type a few characters into the EditText object and hit the Enter key, I retrieve the text in my onKey() listener. When I use the toString() method to retrieve the text I get back a weird string like:

                  android.widget.EditText@43749ff0

                  android.widget.EditText@43749ff0

                  尽管 EditText.mText 属性确实显示了我在测试期间输入的字符串123".为什么 toString() 返回不同的结果以及似乎是某种取消初始化"值?如何在 mText 属性中获取当前所需的字符串,那个奇怪的值是什么?

                  Despite the fact the EditText.mText property does show the string I entered, "123" during my tests. Why is toString() returning a different result and what appears to be some kind of "uninitalize" value? How do I get the desired string currently in the mText property and what is that strange value?

                  -- 罗施勒

                  推荐答案

                  你在一个视图对象上调用 toString(),它可能没有定义 toString().

                  You are calling toString() on a View Object, which probably does not have a toString() defined.

                  我相信你想这样称呼:

                  editText.getText().toString()

                  editText.getText().toString()

                  这篇关于在 Android 项目中使用 EditText.toString() 方法获取奇怪的文本.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                        <tbody id='wmyAT'></tbody>
                    • <small id='wmyAT'></small><noframes id='wmyAT'>

                        <i id='wmyAT'><tr id='wmyAT'><dt id='wmyAT'><q id='wmyAT'><span id='wmyAT'><b id='wmyAT'><form id='wmyAT'><ins id='wmyAT'></ins><ul id='wmyAT'></ul><sub id='wmyAT'></sub></form><legend id='wmyAT'></legend><bdo id='wmyAT'><pre id='wmyAT'><center id='wmyAT'></center></pre></bdo></b><th id='wmyAT'></th></span></q></dt></tr></i><div id='wmyAT'><tfoot id='wmyAT'></tfoot><dl id='wmyAT'><fieldset id='wmyAT'></fieldset></dl></div>

                            <bdo id='wmyAT'></bdo><ul id='wmyAT'></ul>
                            <tfoot id='wmyAT'></tfoot><legend id='wmyAT'><style id='wmyAT'><dir id='wmyAT'><q id='wmyAT'></q></dir></style></legend>