我正在做一个警报系统。警报工作正常,但声音不起作用..我正在做一个小测试,但我不明白问题出在哪里..在警报活动中,我有以下代码:
setVolumeControlStream(AudioManager.STREAM_MUSIC);
soundPool = new SoundPool(20, AudioManager.STREAM_MUSIC, 0);
try {
AssetManager assetManager = getAssets();
AssetFileDescriptor descriptor = assetManager.openFd("sound.ogg");
mySoundId = soundPool.load(descriptor, 1);
} catch (IOException e) {
Log.d(TAG,"We've problem's!!, "
+ e.getMessage());
}
soundPool.play(mySoundId, 1, 1, 0, 0, 1);
没有错误..但音乐不起作用..相反,如果我在底部工作中编程 PLAY!任何人都可以帮助我吗?