在 Android 中获取“窗口已经聚焦,忽略焦点增益:com.android.internal.view.IInputMethodClient$Stub$Proxy”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3140524/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:53:40  来源:igfitidea点击:

Geting "Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy" in Android

androidandroid-intentwarnings

提问by kaibuki

When I am going from one intent to another intent, I am getting this warning :

当我从一个意图转向另一个意图时,我收到以下警告:

"Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy"

“窗口已经聚焦,忽略焦点增益:com.android.internal.view.IInputMethodClient$Stub$Proxy”

and the view stays on the old intent.

并且观点停留在旧的意图上。

the code is :

代码是:

   btnCatalog.setOnClickListener(new OnClickListener() {
   private ProgressDialog myProgressDialog;
   @Override
   public void onClick(View v) {
    // TODO Auto-generated method stub
    myProgressDialog = ProgressDialog.show(introPage.this,
      "Please wait...", "Doing Extreme Calculations...", true);
    new Thread() {
     public void run() {
      try{
       fetchAndStoreData();
       Intent toMainPage = new Intent(introPage.this, mainPage.class);
       startActivity(toMainPage);
       sleep(5000);
      } catch (Exception e) { }
      myProgressDialog.dismiss();
     }
    }.start();
   }
  });

but when I comment the fetchandStoreData() method, then the intent moves to another intent. the fetchAndStoreData() method is reading XML reading data from files and also saving data into SQLLite database.

但是当我评论 fetchandStoreData() 方法时,意图会转移到另一个意图。fetchAndStoreData() 方法从文件中读取 XML 读取数据并将数据保存到 SQLLite 数据库中。

so far I am having no idea why this warning is occurring.

到目前为止,我不知道为什么会发生此警告。

need urgent help

需要紧急帮助

Thanks

谢谢

采纳答案by NicoMinsk

I had this error when "mainPage" (started intent) was not declared on Manifest file,
try to add :
<activity android:name=".mainPage" />

当清单文件中未声明“mainPage”(启动意图)时出现此错误,请
尝试添加:
<activity android:name=".mainPage" />

回答by Ricket

Another solution: check the onCreate, onResume, etc. methods of your Activity that is being opened. In my case, I had changed some code so that my onCreate method would call this.finish();before the end of the method. I'm guessing some sort of race condition occurs when you do that and every time I opened my Activity I would get the same thing in logcat:

另一个解决方案:检查正在打开的 Activity 的 onCreate、onResume 等方法。就我而言,我更改了一些代码,以便我的 onCreate 方法会this.finish();在方法结束之前调用。我猜当你这样做时会发生某种竞争条件,每次我打开我的 Activity 我都会在 logcat 中得到同样的东西:

W/InputManagerService(  104): Window already focused, 
ignoring focus gain of: 
com.android.internal.view.IInputMethodClient$Stub$Proxy@46399630

Fix the activity that's being opened!If you need to close the activity immediately after opening, find some other way to do it; maybe via the runOnUiThreadmethod, I don't know.

修复正在打开的活动!如果您需要在打开后立即关闭活动,请寻找其他方法;也许通过runOnUiThread方法,我不知道。

回答by user714056

I had a different problem. I was able to change activities once, but not more than that. I think it was a combination of using Intent.FLAG_ACTIVITY_NO_HISTORYwhen navigating to the second Activity, and using Activity.startActivityto return to the first application. When I switched to using Activity.finish()to leave the second Activityand return to the first, everything started working better.

我有一个不同的问题。我能够改变一次活动,但不能不止一次。我认为这是Intent.FLAG_ACTIVITY_NO_HISTORY导航到第二个应用程序时Activity使用和使用Activity.startActivity返回到第一个应用程序的组合。当我切换到使用Activity.finish()离开第二个Activity并返回第一个时,一切都开始变得更好了。

回答by Billy Tobon

Got the same problem yesterday, due to a typo in the activity declaration on androidManifest.xml,but even after fixed the error persisted.

昨天遇到了同样的问题,由于 androidManifest.xml 上的活动声明有错别字,但即使修复了错误仍然存​​在。

After restarting the Eclipse and the emulator I got this message in the console:once the main activity was launched:

重新启动 Eclipse 和模拟器后,我在控制台中收到此消息:启动主活动后:

"emulator: emulator window was out of view and was recentred"

“模拟器:模拟器窗口不在视野范围内,并且已重新设置”

and the secondary activity launched w/o problems.

并且次要活动启动时没有问题。

回答by maxweber

Some special hidden char or somesuch in the mainifest.xml. Pasted from another manifest.xml:

mainifest.xml 中的一些特殊隐藏字符或类似内容。从另一个 manifest.xml 粘贴:

android:screenOrientation="landscape"

After the problem, deleted and typed in manually. Then clean, build. And works. Fun.

问题解决后,手动删除并输入。然后清理,构建。和作品。乐趣。