2
試圖在我的整個應用程序的很多地方使用的MediaPlayer時減少的行數,我繼承的MediaPlayer,並在構造函數中我調用相同的3條線,每次我需要播放媒體文件重複:MediaPlayer.start()不能在構造函數被調用?
public MyMediaPlayer(Context context, int resid) {
create(context, resid);
setOnCompletionListener(this);
start();
}
所以這不是那3行,我只把這個在來電者:
new MyMediaPlayer(this, R.raw.happybirthday);
它編譯和構建,甚至運行,但媒體文件將不會出於某種原因發揮。
我檢查了logcat的,發現:
07-19 20:00:51.124: E/MediaPlayer(16517): start called in state 1
07-19 20:00:51.124: E/MediaPlayer(16517): error (-38, 0)
什麼這些錯誤是什麼意思?
我錯過了什麼?
BTW,onCompletion()被調用,運行良好。
歡迎您。希望能幫助到你。 – Erol 2012-07-20 00:44:26