• <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() 方法获取奇怪的文本.为什么?

        时间:2023-05-28

        <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() 方法获取奇怪的文本.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Android - 键盘未出现在浮动窗口中 下一篇:如何使用 TextWatcher 更新相同的 EditText?

                  相关文章

                  1. <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>