2
中OpenCore實例的最大數量,它顯示「超出OpenCore實例的最大數量」錯誤。如何解決此錯誤。 謝謝當我運行我的應用程序時,超出了android
中OpenCore實例的最大數量,它顯示「超出OpenCore實例的最大數量」錯誤。如何解決此錯誤。 謝謝當我運行我的應用程序時,超出了android
如果您實例化MediaPlayer的多個實例,則會發生上述情況。
你應該閱讀有關the lifecycle of the media player and its different states
媒體播放器被定義爲一類範圍變量和在OnCreate實例化()方法
private void startPlayingAudio()
{
try {
Uri path1 = Uri.parse("android.resource://com.yourpackagehere./" + R.raw.beep);
mp.reset(); // reset to idle state
mp.setDataSource(this, path1); // from idle to initialised state
mp.prepare();
mp.start();
} catch (Exception ioe) {
Log.e(LOG_TAG, "Error playing the beep sound");
}
}