简体   繁体   English

Android studio:无法将wav文件识别为MediaPlayer的第二个参数

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

When I use MediaPlayer to play a wav file:当我使用 MediaPlayer 播放 wav 文件时:

在此处输入图像描述

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:我遇到了一个问题:无法解析方法'create(com.edu.hitsz.aircraftwar.SecondFragment,int)'我认为这可能是因为wav类型被错误识别,所以我更改了关联类型,就像这个答案:

Why does android studio not recognize .wav / .mp3 files 为什么 android studio 无法识别 .wav / .mp3 文件

在此处输入图像描述

But my problem is still not solved.但是我的问题仍然没有解决。 What's wrong?怎么了?

The first parameter is a context, not a fragment.第一个参数是上下文,而不是片段。 Use getActivity() instead of this.使用 getActivity() 而不是这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM