window already focused - ignoring focus gain of co

2019-02-23 17:44发布

I have seen many solutions to this but none works for me! I faced this problem in two previous occasions and I just had to revert to my backup code for it to work. I never found out why this happens. Some people say its just a warning, so you can ignore it. But I am not able to switch from one intent to another. This is the exact case - I have made a menu from where I add something. So when I click on menu, and then click add item, It doesn't do anything! Just gives this warning and stays on the same screen. So, i am stuck! Can anyone please explain why this error is caused and what is the best way to eliminate it?

WARN/InputManagerService(61): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@405b1d68

2条回答
ら.Afraid
2楼-- · 2019-02-23 17:54

Check your event handler method for the menu. I found that I was using

public boolean onOptionsItemSelected(MenuItem item)

I switched to the following and fixed the problem.

public boolean onMenuItemSelected(int featureId, MenuItem item)

I was getting the same warning message and my event was not firing the next activity. Look at your method and see if it indicates that you are overriding it. I was not. Once I changed the method I was overriding and worked.

查看更多
你好瞎i
3楼-- · 2019-02-23 18:01

Try to add your activity into Manifest file :

<activity android:name="activity name" android:screenOrientation="portrait" ></activity>
查看更多
登录 后发表回答