gpt4 book ai didi

android - 当进度条到达末尾时播放声音,不起作用!

转载 作者:行者123 更新时间:2023-12-03 02:25:05 30 4
gpt4 key购买 nike

公共(public)类 MyCount 扩展了 CountDownTimer
{

    MediaPlayer mp = MediaPlayer.create(this, R.raw.beep1);

public MyCount(long millisInFuture, long countDownInterval)
{
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish()
{
mp.start();
//Start.this.finish();
}
@Override
public void onTick(long millisUntilFinished)
{
total++;
progre.setProgress(total);
}
}

我想在进度条结束时(30秒后)发出声音,但它没有播放。

有谁能够帮助我??

最佳答案

我认为您需要使用以下行:

MediaPlayer mp = MediaPlayer.create(ActivityName.this, R.raw.beep1);

代码中的“this”指的是 MyCount 类,但您想使用 Activity。

关于android - 当进度条到达末尾时播放声音,不起作用!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6412871/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com