Skip to content

Instantly share code, notes, and snippets.

@codingwithsara
Created November 27, 2018 10:10
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/76aec4040bb08be570f2078a61e2a454 to your computer and use it in GitHub Desktop.
Save codingwithsara/76aec4040bb08be570f2078a61e2a454 to your computer and use it in GitHub Desktop.
Android MusicPlayer 5
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
}
);
// Thread (positionBar・経過時間ラベル・残り時間ラベルを更新する)
new Thread(new Runnable() {
@Override
public void run() {
while (mp != null) {
try {
Message msg = new Message();
msg.what = mp.getCurrentPosition();
handler.sendMessage(msg);
Thread.sleep(1000);
} catch (InterruptedException e) {}
}
}
}).start();
}
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
int currentPosition = msg.what;
}
};
public void playBtnClick(View view) {
if (!mp.isPlaying()) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment