Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"

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.

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

need urgent help

Thanks

like image 262
Adil Bhatty Avatar asked Jun 29 '10 12:06

Adil Bhatty


3 Answers

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

like image 122
NicoMinsk Avatar answered Oct 14 '22 06:10

NicoMinsk


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:

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 runOnUiThread method, I don't know.

like image 31
Ricket Avatar answered Oct 14 '22 08:10

Ricket


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_HISTORY when navigating to the second Activity, and using Activity.startActivity to return to the first application. When I switched to using Activity.finish() to leave the second Activity and return to the first, everything started working better.

like image 3
user714056 Avatar answered Oct 14 '22 07:10

user714056