标签:prot manage context str text cat listener creat bsp
Button playButton;
SoundPool sp;
int soundID_1,soundID_2;
int streamID_1,streamID_2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sp=new SoundPool(10, AudioManager.STREAM_MUSIC,0);
soundID_1=sp.load(getApplicationContext(), R.raw.lingsheng, 1);
soundID_2=sp.load(getApplicationContext(), R.raw.moon, 1);
playButton=(Button)findViewById(R.id.play);
playButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
streamID_1=sp.play(soundID_1, 0.8f, 0.8f,1, -1, 1.0f);
streamID_2=sp.play(soundID_2, 0.8f, 0.8f,1, -1, 1.0f);
}
});
}
标签:prot manage context str text cat listener creat bsp
原文地址:http://www.cnblogs.com/liunx1109/p/7376604.html