2013-06-18 2 views
0

내 앱을 실행할 때 간헐적으로 다음 오류가 발생하는 것 같습니다.onCreate 메서드로 대화 상자 만들기 - 누수

내에서 onCreate()와 같은 방법으로 내 대화 상자를 만드는하고있어 모든 "활동은 원래 여기에 추가 된 윈도우 [email protected]를 유출했다" 그래서 :

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

//Create splash-screen object and pass in width and height (width and height are defined and valid, I just removed them from this post to make it more readable) 

    splash = new SplashScreen(MainActivity.this, width, height); 

//Create dialog that will show splash-screen 
    loading_dialog = new Dialog(MainActivity.this,android.R.style.Theme_Black_NoTitleBar_Fullscreen); 

//Set and display splash screen view 
    loading_dialog.setContentView(splash); 
    loading_dialog.show(); 
} 

어떤 아이디어가 될 수 있습니까?

답변

0

표시하기 전에 대화 상자를 만들어야합니다.

은 당신이 할 필요가 : 대신

loading_dialog.create().show(); 

내가 비슷한 질문을 찾을

loading_dialog.show(); 

, 당신은 그들에게

Activity has leaked window [email protected] that was originally added here

Activity has leaked window that was originally added

을 사용할 수 있습니다

Activity has leaked window [email protected] that was originally added here

+0

안녕하세요, @ idan, 고맙지 만 작동하지 않습니다 - 'create()'메소드가 없습니다 .... 내가하고있는 일은 오류가 간헐적 인 것입니다! :-) – Zippy

+1

비슷한 Q에 대한 링크를 추가했는데 도움이 되었기를 바랍니다 ... – idan

1

대화 상자는 onCreate에서 만들 수 있지만 활동을 볼 수 없기 때문에 표시 할 수 없습니다. Google 어딘가에 어떻게해야하는지 예를 들어 보았습니다 ...

0

활동을 종료하기 전에 대화를 취소 (취소)하지 않았기 때문일 수 있습니다. onStop() 메소드의 대화 상자에서 cancel()을 수행하십시오. 도움이 될 것입니다. 도움이 되길 바랍니다.

관련 문제