2017-01-05 5 views

답변

4

처리기를 사용하면 그 시간 이후에 녹음을 단계 처리 할 수 ​​있습니다.

int t = 0; 
handler.postDelayed(new Runnable() { 
    @Override 
    public void run() { 
     textView.setText(getString(R.string.formatted_time, t)); 
     if(++t<10) { 
      handler.postDelayed(this, 1000); 
     } 
    } 
}, 1000); 

FORMATTED_TIME가 같은 것입니다 : 타이머에 관한

Handler handler = new Handler(); 
handler.postDelayed(new Runnable() { 
    @Override 
    public void run() { 
     recorder.stop(); 
    } 
}, DELAY); 

<string android:name="formatted_time">%d seconds</string> 
+0

매력처럼 작동합니다. 감사합니다. – mafioso

+0

로그에 '매초마다'를 쓰는 방법이 있습니까? 그래서 몇 초가 이미 기록되었는지 압니다. – mafioso

+0

위와 같이 1000을 지연으로 사용하고 대신 TextView를 업데이트합니다. – rekire

1
mCountdowntimer=new CountDownTimer(countdownPeriod, 1000) {//countdown Period =5000 

      public void onTick(long millisUntilFinished) { 
       textView.setText("seconds remaining: " + millisUntilFinished/1000); 
      } 

      public void onFinish() { 

       mediaplayer.stop(); } 

     }.start(); 

등) (릴리스를 호출하는 것을 잊지해야합니다 stop()을 호출 한 후;

+0

그래서 당신의보기에서 1 초가 이는가? – mafioso

+0

"countdownPeriod = 5000"을 5 초 동안 입력하십시오. – Simo