gpt4 book ai didi

java - 如何使用 onClick 在 startService() 和 stopService() 之间切换?

转载 作者:行者123 更新时间:2023-12-01 15:52:14 25 4
gpt4 key购买 nike

如何在表面 View 上交替使用这两个 Intent ,并在录制视频时在开始/暂停期间创建 YouTube 中看到的图形效果?

-->stopService(new Intent(getApplicationContext(), ServiceRecording.class));-->startService(new Intent(getApplicationContext(), ServiceRecording.class);

public void onClick(View v)
{

}

最佳答案

有什么原因导致以下想法行不通吗?

if (serviceRunning) {
serviceRunning = false;
stopService(...);
} else {
serviceRunning = true;
startService(...);
}

关于java - 如何使用 onClick 在 startService() 和 stopService() 之间切换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5791848/

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