Skip to content

Instantly share code, notes, and snippets.

@codingwithsara
Created November 27, 2018 00:36
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/029490049af5c7d15e2d1bb1bc0309b7 to your computer and use it in GitHub Desktop.
Save codingwithsara/029490049af5c7d15e2d1bb1bc0309b7 to your computer and use it in GitHub Desktop.
Android MusicPlayer 4
// Media Playerの初期化
mp = MediaPlayer.create(this, R.raw.music);
mp.setLooping(true);
mp.seekTo(0);
mp.setVolume(0.5f, 0.5f);
// 音量調節
volumeBar = findViewById(R.id.volumeBar);
volumeBar.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
}
);
}
public void playBtnClick(View view) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment