Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想实现一个状态栏通知,并向用户发出一些声音和闪烁的警报。
声音播放得非常好,但问题是它停止只是用户点击状态栏。
我想继续播放声音,直到用户不想通过单击任何按钮来停止它。
我怎样才能做到这一点?
infinite loo您需要通过p 和value一次又一次地播放声音maintain a bool来启动和停止声音,因为当用户按下使其为真时,再次单击使其为假并退出循环。您可以使用sharedPreferences存储布尔值。
infinite loo
maintain a bool
sharedPreferences