Android java.lang.IllegalArgumentException: View not attached to window manager -


i getting following exception in code...

illegalargumentexception: view not attached window manager @ android.view.windowmanagerimpl.findviewlocked(windowmanagerimpl.java:355) @ android.view.windowmanagerimpl.removeview(windowmanagerimpl.java:200) @ android.view.window$localwindowmanager.removeview(window.java:432) @ android.app.dialog.dismissdialog(dialog.java:280) @ android.app.dialog.access$000(dialog.java:73) @ android.app.dialog$1.run(dialog.java:113) @ android.app.dialog.dismiss(dialog.java:270) @ com.myapp.code.searchword$1.handlemessage(searchword.java:718)  <-- @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:130) @ android.app.activitythread.main(activitythread.java:3906) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:507) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:840) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:598) 

i don't understand why error occurs. causes force close problem on devices. clue on how fix this? thanks

this code...

public class searchword extends activity { /** called when activity first created. */  private progressdialog progressdialog;         ...     }      public void calldialog(){      this.progressdialog = progressdialog.show(searchword.this,null, "loading. please wait..", true);      new thread(new runnable(){         public void run(){             try{                 thread.sleep(9000);             }             catch (exception e){                 e.printstacktrace();             }             if(copyflag){              }                             else{                 getdata();             }             searchword.this.handler.sendemptymessage(0);         }      }).start(); }      handler handler = new handler(){     public void handlemessage(message msg){         progressdialog.dismiss();           <-- line 718         setdata();     } }; 

i have modified code.look below snippet.

public void calldialog(){              progressdialog progressdialog = new progressdialog(this);             progressdialog.settitle("loading. please wait..");             progressdialog.setcancelable(false);             progressdialog.setprogressstyle(progressdialog.style_spinner);                 progressdialog.show();              new thread(new runnable(){                 public void run(){                     try{                         thread.sleep(9000);                     }                     catch (exception e){                         // todo auto-generated catch block                         e.printstacktrace();                     }                     if(copyflag){                     }else{                         getdata();                     }                     searchword.this.handler.sendemptymessage(0);                 }              }).start();         }           // omitted              handler handler = new handler(){             @override             public void handlemessage(message msg){                 progressdialog.dismiss();                         setdata();             }         }; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

jquery - Invalid Assignment Left-Hand Side -

gmail - Is there any documentation for read-only access to the Google Contacts API? -