안녕하세요 저는 Android를 처음 사용하고 있고 내 앱에서 녹음을 시작할 때 진행률 표시 줄을 업데이트 할 때 진행률 표시 줄을 사용하고 있습니다. 내가 진행 막대 녹음을 중지 여기 때 연속적으로 몇 가지 중 하나가 내가우리가 android에서 Handler를 멈추었을 때 진행 막대를 멈추는 방법
private void startRecording() {
try {
handler = new Handler();
recorderProgressBar = (ProgressBar) dialog.findViewById(R.id.recorder_progressBar);
progressStatus = 0;
// Start the lengthy operation in a background thread
thread = new Thread() {
@Override
public void run() {
while (progressStatus < 100) {
// Update the progress bar
if (handler != null) {
// Update the progress status
progressStatus += 1;
// Try to sleep the thread for 20 milliseconds
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
handler.post(runnable);
}
}
}
};
thread.start();
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
Runnable runnable = new Runnable() {
public void run() {
System.out.println("it's calling ramakrishna");
recorderProgressBar.setProgress(progressStatus);
}
};
private void stopRecording() {
//Kill Background thread
if (handler != null) {
handler.removeCallbacks(runnable);
}
}
확인 나 시도하고 활동 – Krish
더 심지어 내가 나를 – Krish
를 업데이트 ProgressBar를 시작할 때 – Krish