02-17 09:12:01.817: E/WindowManager(2494): Activity com.ui.ProgramsourceListActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@419ddfa8 that was originally added here
02-17 09:12:01.817: E/WindowManager(2494): android.view.WindowLeaked: Activity com.ui.ProgramsourceListActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@419ddfa8 that was originally added here
02-17 09:12:01.817: E/WindowManager(2494): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:363)
02-17 09:12:01.817: E/WindowManager(2494): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:268)
02-17 09:12:01.817: E/WindowManager(2494): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:216)
02-17 09:12:01.817: E/WindowManager(2494): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:141)
02-17 09:12:01.817: E/WindowManager(2494): at android.view.Window$LocalWindowManager.addView(Window.java:537)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.Dialog.show(Dialog.java:278)
02-17 09:12:01.817: E/WindowManager(2494): at com.ui.ProgramsourceListActivity.initDialog(ProgramsourceListActivity.java:101)
02-17 09:12:01.817: E/WindowManager(2494): at com.ui.ProgramsourceListActivity.onCreate(ProgramsourceListActivity.java:96)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.Activity.performCreate(Activity.java:4479)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.ActivityThread.access$600(ActivityThread.java:134)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
02-17 09:12:01.817: E/WindowManager(2494): at android.os.Handler.dispatchMessage(Handler.java:99)
02-17 09:12:01.817: E/WindowManager(2494): at android.os.Looper.loop(Looper.java:154)
02-17 09:12:01.817: E/WindowManager(2494): at android.app.ActivityThread.main(ActivityThread.java:4644)
02-17 09:12:01.817: E/WindowManager(2494): at java.lang.reflect.Method.invokeNative(Native Method)
02-17 09:12:01.817: E/WindowManager(2494): at java.lang.reflect.Method.invoke(Method.java:511)
02-17 09:12:01.817: E/WindowManager(2494): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
02-17 09:12:01.817: E/WindowManager(2494): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
02-17 09:12:01.817: E/WindowManager(2494): at dalvik.system.NativeStart.main(Native Method)
看了网上的很多方法,什么在Dialog finish()之间线dismiss之类等等,但是我在程序当中本身就已经做过这不处理了还是报了这个异常,不知道,正苦恼着呢?求高人指点!
上代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//强制竖屏
mApp = (MyApplication) getApplication();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getString(R.string.video_source_title));
LayoutInflater inflater = getLayoutInflater();
layout = inflater.inflate(R.layout.programe_source_list,
(ViewGroup) findViewById(R.id.program_source_list_layout));
mProSourceListView = (ListView) layout.findViewById(R.id.pro_source_list);
... ...
builder.setView(layout);
mDialog = builder.create();
initDialog();
}
private void initDialog() {
mDialog.setCanceledOnTouchOutside(false);
mDialog.show(); //这一行报错
mDialog.setOnCancelListener(new OnCancelListener(){
public void onCancel(DialogInterface dialog) {
mDialog.dismiss();
finish();
}
});
}
|