java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@450b2f48 异常处理

晕死的错误,改了半天也没想到是这样的原因,基础正要呀。。。

先看一下警告信息:

07-07 08:32:19.540: WARN/WindowManager(74): Failed looking up window
07-07 08:32:19.540: WARN/WindowManager(74): java.lang.IllegalArgumentException:Requested window android.os.BinderProxy@450b2f48 does not exist
07-07 08:32:19.540: WARN/WindowManager(74):     at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9293)
07-07 08:32:19.540: WARN/WindowManager(74):     at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9284)
07-07 08:32:19.540: WARN/WindowManager(74):     at com.android.server.WindowManagerService.relayoutWindow(WindowManagerService.java:2364)
07-07 08:32:19.540: WARN/WindowManager(74):     at com.android.server.WindowManagerService$Session.relayout(WindowManagerService.java:6782)
07-07 08:32:19.540: WARN/WindowManager(74):     at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:117)
07-07 08:32:19.540: WARN/WindowManager(74):     at com.android.server.WindowManagerService$Session.onTransact(WindowManagerService.java:6743)
07-07 08:32:19.540: WARN/WindowManager(74):     at android.os.Binder.execTransact(Binder.java:288)
07-07 08:32:19.540: WARN/WindowManager(74):     atdalvik.system.NativeStart.run(Native Method)

Java代码如下:

 

[java] view plaincopy
 
  1. public class MyActivity extends Activity implements Runnable {  
  2.     private static final int SEARCH_APP = 0;  
  3.     private ProgressDialog pd;  
  4.     private Handler mHandler = new Handler() {  
  5.         public void handleMessage(Message msg) {  
  6.             super.handleMessage(msg);  
  7.             if (msg.what == SEARCH_APP) {  
  8.                 pd.dismiss();  
  9.             }  
  10.         }  
  11.     };  
  12.   
  13.     public void onCreate(Bundle savedInstanceState) {  
  14.         super.onCreate(savedInstanceState);  
  15.         setContentView(R.layout.show_app_grid);  
  16.   
  17.         pd = ProgressDialog.show(this, "请稍候···", "正在搜索你所安装的程序···");  
  18.         Thread t = new Thread(this);  
  19.         t.start();  
  20.   
  21.     }  
  22.   
  23.     public void run() {  
  24.         try {  
  25.             Thread.sleep(3000);  
  26.         } catch (InterruptedException e) {  
  27.             e.printStackTrace();  
  28.         }  
  29.         mHandler.sendEmptyMessage(SEARCH_APP);  
  30.     }  
  31. }  

 

原因是语句Thread t = new Thread()没有谢参数,因为在实现多线时如果是实现的Runnable接口,必要Thread t = new Thread(Runnable runnable),所以把语句Thread t = new Thread()修改为Thread t = new Thread(this)运行就正确了。

java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@450b2f48 异常处理,布布扣,bubuko.com

java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@450b2f48 异常处理

上一篇:Windows server 2012/2106系统安装zabbix3.2客户端


下一篇:delphi 窗体的位置和高宽度-TForm:Letf、Top、Width、Height、ClientWidth、ClientHeight