如何使用媒体播放器设置对象。我希望进入OnCompletionListener
MediaPlayer mp = new MediaPlayer();
//mp.set("data"); // i wonna put string data
mp.setDataSource(sound);
} catch (Exception e) {
e.printStackTrace();
}
mp.setOnCompletionListener(completelistner);
OnCompletionListener completelistner = new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
//mp.get("data");
}
};
答案 0 :(得分:1)
像这样:
public class YourClass {
private MediaPlayr mp; // now it is a global variable
mp = new MediaPlayer();
}
编辑:根据Google documentation,MediaPlayer(mp)没有任何mp.set(String)或mp.get(String)方法。