2014-11-15 2 views
1

API에 대해 알림을 확인하는 방법이 있습니다.SoundPoolImpl.finalize()에 의한 TimeoutException 오류가 10 초 후에 시간 초과되었습니다.

public void initNotification(Context cntx, final Typeface typeface){ 

    if(User_Session.isLoggedIn() != true){ 
     mNotifHolder.setVisibility(View.INVISIBLE); 
    }else{ 
     mNotifHolder.setVisibility(View.VISIBLE); 

     mNotifHolder.setOnClickListener(openNotifActivity); 
     HashMap<String, String> user = User_Session.GetUserDetails(); 
     String strToken  = user.get(SessionManagement.KEY_USERTOKEN); 
     String URL   = Constants.NotifiCount_URL+strToken; 
     if (NotificationCount != null && !NotificationCount.isDone() && !NotificationCount.isCancelled()){ return; } 
     NotificationCount = Ion.with(cntx).load(URL).asJsonObject().setCallback(new FutureCallback<JsonObject>() { 

      @Override 
      public void onCompleted(Exception e, JsonObject result) { 

       System.out.println("RESULT OF NOTIFICATION COUNT: "+result); 
       if(e == null){ 
        if(result != null){ 

         String count   = result.get("count").getAsString(); 
         if(count.equals("0")){ 
          mNotifHolder.setVisibility(View.VISIBLE); 
          notifBack.setBackgroundResource(R.drawable.ic_notif_off); 
          notifText.setVisibility(View.INVISIBLE); 
         }else{ 

          AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE); 
          float actualVolume = (float) audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); 
          float maxVolume = (float) audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); 
          float volume = actualVolume/maxVolume; 
          if (loaded) { 
           soundPool.play(soundID, volume, volume, 1, 0, 1f); 
          } 

          int Count = Integer.parseInt(count); 
          if(Count > 10){ 
           count = "+10"; 
          } 
          notifBack.setBackgroundResource(R.drawable.ic_notif_on); 
          notifText.setVisibility(View.VISIBLE); 
          notifText.setTypeface(typeface); 
          notifText.setText(count); 
          mNotifHolder.setVisibility(View.VISIBLE); 
          ScaleAnimation scale = new ScaleAnimation(0, 1, 0, 1, ScaleAnimation.RELATIVE_TO_SELF, .5f, ScaleAnimation.RELATIVE_TO_SELF, .5f); 
          scale.setDuration(300); 
          scale.setInterpolator(new OvershootInterpolator()); 
          mNotifHolder.startAnimation(scale); 
         } 

        }else{ 
         Crouton.makeText(MainActivity.this, "ERROR", Style.ALERT).show(); 
        } 
       }else{ 
        Crouton.makeText(MainActivity.this, "ERROR", Style.ALERT).show(); 
       } 

      } 
     }); 
    } 

} 

을하지만 가끔은 응용 프로그램은 추락하고 나는 일부 장치에서이 오류 있어요 :이 방법에 나는 보여주는 통지에 의해, 소리 (작은 크기의 소리)를 재생하기 위해 노력하고있어

java.util.concurrent.TimeoutException: android.media.SoundPool$SoundPoolImpl.finalize() timed out after 10 seconds 
      at android.media.SoundPool$SoundPoolImpl.release(Native Method) 
      at android.media.SoundPool$SoundPoolImpl.finalize(SoundPool.java:616) 
      at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:187) 
      at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:170) 
      at java.lang.Thread.run(Thread.java:841) 

어떻게 내가 해결해야합니까?

답변

0

당신은 당신의 sound pool출시정지를 방법을 추가해야합니다.

soundPool.stop(streamID); 
soundPool.release(); 
관련 문제