Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Playing sound
- // will play button toggle sound on flash on / off
- private void playSound(){
- if(isFlashOn){
- mp = MediaPlayer.create(MainActivity.this, R.raw.light_switch_off);
- }else{
- mp = MediaPlayer.create(MainActivity.this, R.raw.light_switch_on);
- }
- mp.setOnCompletionListener(new OnCompletionListener() {
- @Override
- public void onCompletion(MediaPlayer mp) {
- // TODO Auto-generated method stub
- mp.release();
- }
- });
- mp.start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement