当我运行我的应用程序时,它显示“超过OpenCore实例的最大数量”error.How来解决这个错误。谢谢
发布于 2011-03-29 01:21:05
如果您实例化MediaPlayer的多个实例,则会发生上述情况。
您应该阅读有关the lifecycle of the media player and its different states的文章
Media Player被定义为一个类范围变量,并在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");
}
}https://stackoverflow.com/questions/2432191
复制相似问题