开发者

In Android, media player not working

The media player is not working when I try the fol开发者_StackOverflow社区lowing:

             player=MediaPlayer.create(this, R.raw.mh);
             player.start();

I receive this error:

The method create(Context, int) in the type MediaPlayer is not applicable for the arguments (new View.OnClickListener(){}, int)


It is probably because this code is located inside of another class / anonymous class. You should not use this, but MyActivityClassName.this whatever your activity name is.


u can try this

MediaPlayerInstance.play(this, R.raw.mh);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜