2014-04-08 2 views
1

미디어 플레이어가 있고 미디어 컨트롤러와 연결되어 있습니다. 컨트롤이 정상적으로 작동하고 있습니다. 나는이 두 가지 문제를 얻고있다Media Controller가 숨겨져 있지만 미디어 플레이어가 계속 재생됩니다.

는 : 미디어 플레이어 재생을 계속하지만

  1. 사용자가 접촉 한 후 화면의 다른 부분을 접촉, 즉 미디어 컨트롤러가 초점, 도착, 미디어 컨트롤러는 숨 깁니다 ,

  2. 내가 다시 눌러

    은 이전 활동까지 시작, 미디어 컨트롤러 가죽하지만 미디어 플레이어

계속 재생 아래 코드를 시도했지만 다음 오류가 발생하여 응용 프로그램이 다운됩니다. 이것에 대한 제안?

코드 :

mediaController = new MediaController(getActivity()){ 
          @Override 
          public void hide() 
          { 

           if(mediaPlayer.isPlaying()){ 
            mediaPlayer.stop(); 
           } 
           mediaController.hide(); 
          } 


         }; 

스택 트레이스 응용 프로그램 충돌 :

04-09 00:32:49.841: E/AndroidRuntime(3911): FATAL EXCEPTION: main 
04-09 00:32:49.841: E/AndroidRuntime(3911): Process: com.itspirits.lifenavigatorlite, PID: 3911 
04-09 00:32:49.841: E/AndroidRuntime(3911): java.lang.StackOverflowError 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:214) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.ArticleFragment$2$2.hide(ArticleFragment.java:217) 
04-09 00:32:49.841: E/AndroidRuntime(3911):  at com.itspirits.lifenavigatorlite.Artic 
+0

어쩌면 stop()을 호출 한 이후로 mediaPlayer를 릴리스해야합니다. release() –

+0

을 시도해보십시오. 정지 후 여전히 호출을 호출합니다. – Noor

답변

2

이 당신의 숨기기 내부() 메소드보십시오 :

super.hide(); 

대신 :

mediaController.hide(); 
,536을

당신이 영원한 고리를 만들었던 것처럼 보입니다.

+1

동의 함 +1. mediaController 객체가 자체 선언 내에서 사용되고 있습니다. – Aaron