【问题标题】:What is the problem with this code ?Why is not working ,it tellls me "Illegal Start of expression","expected ;" and it points me to (View V))这段代码有什么问题?为什么不起作用,它告诉我“Illegal Start of expression”,“expected ;”它指向我(视图 V))
【发布时间】:2019-05-17 12:45:10
【问题描述】:
sound1= sounds.load(getApplicationContext(),R.raw.sound1,1);

这是一个想要在单击button 时播放声音的函数。

public void playsound1(View v ) {
 sounds.play(sound1,1.0f,1.0f,0,10f);
}

但我不知道为什么它不起作用?

【问题讨论】:

标签: android android-sound


【解决方案1】:

在您的代码中查看您的方法上方。你一定忘记在上面加上} 符号来关闭方法了。

【讨论】:

  • 这只是我的代码的一部分......它不是整个代码,但我不会错过任何一个}相信我,我不知道为什么我的代码给了我很多错误,因为是唯一的,因为有 9 种方法 playsound1 ... 9 对所有这些方法都是一个问题
  • 尝试正确格式化代码,您可能会很快发现缺少的内容@BotaRafael
  • 在 android studio 中的格式很好,但我不知道为什么它不起作用....如果有人可以提供帮助,也许一些 teamviewer 会帮助我
猜你喜欢
  • 2022-06-10
  • 1970-01-01
  • 2021-06-23
  • 1970-01-01
  • 1970-01-01
  • 2020-02-21
  • 2020-10-30
  • 2010-11-08
相关资源
最近更新 更多