Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
- fab.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- int scrno = mViewPager.getCurrentItem();
- if (scrno==1){
- mediaPlayer= MediaPlayer.create(getApplicationContext(),R.raw.s1);
- }
- else if (scrno==2){
- mediaPlayer= MediaPlayer.create(getApplicationContext(),R.raw.s2);
- }
- else if (scrno==3){
- mediaPlayer= MediaPlayer.create(getApplicationContext(),R.raw.s3);
- }
- else if (scrno==4){
- mediaPlayer= MediaPlayer.create(getApplicationContext(),R.raw.s4);
- }
- else if (scrno==5){
- mediaPlayer= MediaPlayer.create(getApplicationContext(),R.raw.s5);
- }
- mediaPlayer.start();
- }//end onClick FAB
- MediaPlayer mediaPlayer;
- });
Advertisement
Add Comment
Please, Sign In to add comment