我在方法中写了这段代码onCreate()
,但是什么都没播放!
SoundPool mSound = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
AudioManager mAudioManager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
int soundID = mSound.load(this, R.raw.sound1, 1);
int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
mSound.play(soundID, streamVolume, streamVolume, 1, 0, 1f);
问题 #1:我的代码有问题吗?我做错了吗?
如果不,
问题 #2:我的声音是.amr
文件。支持SoundPool
吗?支持的类型有哪些?