Home > Software engineering >  Android studio:Can't recognize the wav file as the second param to MediaPlayer
Android studio:Can't recognize the wav file as the second param to MediaPlayer

Time:07-24

When I use MediaPlayer to play a wav file:

enter image description here

I got a problem:Cannot resolve method 'create(com.edu.hitsz.aircraftwar.SecondFragment, int)' I assume that this might because the wav type was wrongly recognized, so I change the associated type do like this answer:

enter image description here

But my problem is still not solved. What's wrong?

CodePudding user response:

The first parameter is a context, not a fragment. Use getActivity() instead of this.

  • Related