为什么在onResume函数中添加password.setText(“”)后editText无法输入?
我做了一个Android应用程序。其中之一是登录。在此活动中,我有一个名为密码的 EditText。按登录按钮后,它将打开一个新活动以准备执行其他操作。如果在服务器上验证密码失败,我将完成()新活动并返回到旧活动。我想清除已输入的密码。所以我在onResume()方法中使用password.setText("")。
但是,如果我多次输入错误的密码,如您所见,活动多次打开和关闭,则 EditText 密码无法输入任何内容,直到我关闭活动并再次打开它。
这是 logcat 信息:
05-31 16:11:30.067: VERBOSE/WindowManager(2335): Remove Window{47cd7058 com.nationz.szt/com.nationz.szt.ChargeFromRelate2 paused=false}: mSurface=Surface(name=com.nationz.szt/com.nationz.szt.ChargeFromRelate2, identity=691) mExiting=false isAnimating=false app-animation=null inPendingTransaction=false mDisplayFrozen=false
05-31 16:11:30.067: ERROR/WindowManager(2335): return in removeWindowLocked
05-31 16:11:33.657: VERBOSE/WindowManager(2335): Remove Window{478bad38 com.nationz.szt/com.nationz.szt.ChargeFromRelate2 paused=true}: mSurface=Surface(name=com.nationz.szt/com.nationz.szt.ChargeFromRelate2, identity=693) mExiting=false isAnimating=true app-animation=com.android.server.WindowManagerService$DummyAnimation@477d7c40 inPendingTransaction=true mDisplayFrozen=false
05-31 16:11:33.657: ERROR/WindowManager(2335): return in removeWindowLocked
05-31 16:11:33.677: INFO/[POST_RESELECT](5092): [spanChange] (o, oldStart, newStart, oldEnd, newEnd)=(android.text.Selection$START@401245a0,-1,0,-1,0)
05-31 16:11:33.677: INFO/[POST_RESELECT](5092): [spanChange] (o, oldStart, newStart, oldEnd, newEnd)=(android.text.Selection$END@4014c1e0,-1,0,-1,0)
05-31 16:11:33.677: DEBUG/InputManagerService(2335): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@47c98a78 (uid=10094 pid=5092)
05-31 16:11:33.707: DEBUG/InputManagerService(2335): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@47844ae8
05-31 16:11:33.777: VERBOSE/WindowManager(2335): Remove Window{47bc8f88 com.nationz.szt/com.nationz.szt.ChargeFromRelate2 paused=false}: mSurface=Surface(name=com.nationz.szt/com.nationz.szt.ChargeFromRelate2, identity=692) mExiting=true isAnimating=true app-animation=android.view.animation.AnimationSet@479a2608 inPendingTransaction=false mDisplayFrozen=false
05-31 16:11:33.777: ERROR/WindowManager(2335): return in removeWindowLocked
05-31 16:11:34.557: DEBUG/FriendStreamWidgetView(2483): handleReceivedIntent SIP isCurrentlyVisisble=true
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): beginBatchEdit on inactive InputConnection
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): commitText on inactive InputConnection
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): InputConnection = null, active client = true
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): endBatchEdit on inactive InputConnection
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): beginBatchEdit on inactive InputConnection
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): commitText on inactive InputConnection
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): InputConnection = null, active client = true
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): endBatchEdit on inactive InputConnection
05-31 16:11:36.547: WARN/IInputConnectionWrapper(5092): beginBatchEdit on inactive InputConnection
05-31 16:11:36.547: WARN/IInputConnectionWrapper(5092): commitText on inactive InputConnection
有人知道为什么吗? 顺便说一句:如果我删除 password.setText("") 部分。它会工作得很好。
I made an Android application. One of the parts is login. In this activity, I have a EditText which name is password. After press the login button, it will open a new activity to prepare to do something else. If validate the password fail on the server, I will finish() the new activity and back to the old one. I want to clear the password which have been entered. so I use password.setText("") in the onResume() method.
But if I type wrong password for several times, as you see, the activity open and close several times, the EditText password cannot input anything until I close the activity and open it again.
here is the logcat info:
05-31 16:11:30.067: VERBOSE/WindowManager(2335): Remove Window{47cd7058 com.nationz.szt/com.nationz.szt.ChargeFromRelate2 paused=false}: mSurface=Surface(name=com.nationz.szt/com.nationz.szt.ChargeFromRelate2, identity=691) mExiting=false isAnimating=false app-animation=null inPendingTransaction=false mDisplayFrozen=false
05-31 16:11:30.067: ERROR/WindowManager(2335): return in removeWindowLocked
05-31 16:11:33.657: VERBOSE/WindowManager(2335): Remove Window{478bad38 com.nationz.szt/com.nationz.szt.ChargeFromRelate2 paused=true}: mSurface=Surface(name=com.nationz.szt/com.nationz.szt.ChargeFromRelate2, identity=693) mExiting=false isAnimating=true app-animation=com.android.server.WindowManagerService$DummyAnimation@477d7c40 inPendingTransaction=true mDisplayFrozen=false
05-31 16:11:33.657: ERROR/WindowManager(2335): return in removeWindowLocked
05-31 16:11:33.677: INFO/[POST_RESELECT](5092): [spanChange] (o, oldStart, newStart, oldEnd, newEnd)=(android.text.Selection$START@401245a0,-1,0,-1,0)
05-31 16:11:33.677: INFO/[POST_RESELECT](5092): [spanChange] (o, oldStart, newStart, oldEnd, newEnd)=(android.text.Selection$END@4014c1e0,-1,0,-1,0)
05-31 16:11:33.677: DEBUG/InputManagerService(2335): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@47c98a78 (uid=10094 pid=5092)
05-31 16:11:33.707: DEBUG/InputManagerService(2335): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@47844ae8
05-31 16:11:33.777: VERBOSE/WindowManager(2335): Remove Window{47bc8f88 com.nationz.szt/com.nationz.szt.ChargeFromRelate2 paused=false}: mSurface=Surface(name=com.nationz.szt/com.nationz.szt.ChargeFromRelate2, identity=692) mExiting=true isAnimating=true app-animation=android.view.animation.AnimationSet@479a2608 inPendingTransaction=false mDisplayFrozen=false
05-31 16:11:33.777: ERROR/WindowManager(2335): return in removeWindowLocked
05-31 16:11:34.557: DEBUG/FriendStreamWidgetView(2483): handleReceivedIntent SIP isCurrentlyVisisble=true
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): beginBatchEdit on inactive InputConnection
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): commitText on inactive InputConnection
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): InputConnection = null, active client = true
05-31 16:11:35.439: WARN/IInputConnectionWrapper(5092): endBatchEdit on inactive InputConnection
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): beginBatchEdit on inactive InputConnection
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): commitText on inactive InputConnection
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): InputConnection = null, active client = true
05-31 16:11:36.187: WARN/IInputConnectionWrapper(5092): endBatchEdit on inactive InputConnection
05-31 16:11:36.547: WARN/IInputConnectionWrapper(5092): beginBatchEdit on inactive InputConnection
05-31 16:11:36.547: WARN/IInputConnectionWrapper(5092): commitText on inactive InputConnection
Anybody know why?
BTW: If I remove the password.setText("") part. it will works fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来可能与您所看到的有关。
http://code.google.com/p/android/issues/detail ?id=17508
This looks like it might be related to what you're seeing.
http://code.google.com/p/android/issues/detail?id=17508