Skip to content

Instantly share code, notes, and snippets.

@codingwithsara
Created November 27, 2018 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingwithsara/31b2c00303a6c0f41c369ba25608f9a8 to your computer and use it in GitHub Desktop.
Save codingwithsara/31b2c00303a6c0f41c369ba25608f9a8 to your computer and use it in GitHub Desktop.
Android MusicPlayer 5
private Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
int currentPosition = msg.what;
// 再生位置を更新
positionBar.setProgress(currentPosition);
// 経過時間ラベル更新
String elapsedTime = createTimeLabel(currentPosition);
elapsedTimeLabel.setText(elapsedTime);
// 残り時間ラベル更新
String remainingTime = "- " + createTimeLabel(totalTime - currentPosition);
remainingTimeLabel.setText(remainingTime);
return true;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment