开发者

In Android, media player not working

开发者 https://www.devze.com 2023-02-21 21:37 出处:网络
The media player is not working when I try the fol开发者_StackOverflow社区lowing: player=MediaPlayer.create(this, R.raw.mh);

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

精彩评论

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