onstop() for mp3 files
- by kostas_menu
i have this two button.as i press the first it plays an mp3 file.but if i press the second and the first mp3 hasnt finished yet,they play both together.how could i fix it??this is my btn code!!thanks
Button button = (Button) findViewById(R.id.btn);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
MediaPlayer mp = MediaPlayer.create(olympiakos.this, R.raw.myalo);
mp.start();
Toast.makeText(olympiakos.this, "Eisai sto myalo", Toast.LENGTH_SHORT).show();
}
});
Button button2 = (Button) findViewById(R.id.btn2);
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
MediaPlayer mp = MediaPlayer.create(olympiakos.this, R.raw.thryleole);
mp.start();
Toast.makeText(olympiakos.this, "thryle ole trelenomai", Toast.LENGTH_SHORT).show();
}