更新时间:2023-02-27 08:01:36
我认为您应该考虑使用SoundPool.
I think you should consider using SoundPool instead.
SoundPool soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 100);
HashMap<Integer, Integer> soundPoolMap soundPoolMap = new HashMap<Integer, Integer>();
soundPoolMap.put(soundID, soundPool.load(this, R.raw.your_sound, 1));
然后您可以使用以下声音播放声音:
And then you can play the sound using:
soundPool.play(soundId, 1, 1, 1, 0, 0);