이것은 사용자가 처음으로 응용 프로그램을 설치할 때만 나타나는 대화 상자입니다. 내 장치로 테스트 한 후에 상자가 팝업 된 후에 아무 것도하지 않으면 애플리케이션이 다운되는 것을 볼 수 있습니다. 내 의도는이 대화 상자가 사용자가 응용 프로그램을 설치 한 후 제일 먼저 보게하는 것입니다. 표시되지만 사용자가 약 3 초 내에 버튼을 누르지 않으면 앱이 충돌합니다. 그러나 충돌 후 앱을 다시 시작하면 사용자가 상자의 목표 인 버튼을 누를 때까지 상자가 영원히 표시됩니다. 여기 대화 상자로 인해 응용 프로그램이 손상됩니다.
는 로그 캣입니다 :12-13 15:25:28.625: ERROR/WindowManager(15315): Activity com.nick.simplequiz.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41506ff0 V.E..... R....... 0,0-684,679} that was originally added here
android.view.WindowLeaked: Activity com.nick.simplequiz.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41506ff0 V.E..... R....... 0,0-684,679} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:458)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94)
at android.app.Dialog.show(Dialog.java:286)
at com.nick.simplequiz.MainActivity.onCreate(MainActivity.java:216)
at android.app.Activity.performCreate(Activity.java:5165)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1103)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2419)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:5751)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115)
at dalvik.system.NativeStart.main(Native Method)
이 오류가 로그 캣에 따라 일어나는 라인 :
이 발생하는 원인이 될 수 무엇alertDialog.show();
?
이
은onCreate
방법 내부 코드입니다 :
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);
alertDialogBuilder.setCancelable(false);
alertDialogBuilder.setTitle("...."); //Set the title of the box
alertDialogBuilder.setMessage("....");
alertDialogBuilder.setPositiveButton("Dismiss", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel(); //when they click dismiss we will dismiss the box
SharedPreferences.Editor edit2 = sp.edit();
edit2.putInt("SHOW", 1);
edit2.commit();
}
});
alertDialogBuilder.setNegativeButton("", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
.......
}
});
AlertDialog alertDialog = alertDialogBuilder.create(); //create the box
alertDialog.show(); //*************error happens here
아무 말도하지 않으면 기기가 잠자기/이력서로 전환 될 때 충돌이 발생합니까? 여기에 시간 구성 요소가 있습니까? – thegrinner
코드 게시 위치 : alertDialog.show(); – ramaral
앱이 열렸을 때 3 초가 지나면 충돌이 발생합니다. – ez4nick