0

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?

xiunian
  • 97
  • 5
  • are you shure that `raw` files aren't resolved properly? what is `this` on your code screenshot (NEVER post text as image)? should be `Context`, so use `requireContext()` method instead of `this` – snachmsm Jul 22 '22 at 15:45

1 Answers1

2

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

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127