Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity extends AppCompatActivity{
- MediaPlayer mp;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
- //sound onClick's
- public void sound1(View view){
- mp= MediaPlayer.create(this, R.raw.sound1);
- mp.start();
- }
- public void sound2(View view){
- mp= MediaPlayer.create(this, R.raw.sound2);
- mp.start();
- }
- public void sound3(View view){
- mp= MediaPlayer.create(this, R.raw.sound3);
- mp.start();
- }
- public void sound4(View view){
- mp= MediaPlayer.create(this, R.raw.sound4);
- mp.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement