Search code examples
androidandroid-studiowav

Android studio:Can't recognize the wav file as the second param to MediaPlayer


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:

Why does android studio not recognize .wav / .mp3 files

enter image description here

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


Solution

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