2011-04-05 79 views
-1

当我尝试下面的媒体播放器不能正常工作:在Android中,媒体播放器不能正常工作

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

我收到此错误:

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

回答

6

这可能是因为这段代码位于内另一类/匿名类。不管你的活动名是什么,你都不应该使用this,而是使用MyActivityClassName.this

-1

ü可以试试这个

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