当我退出应用程序的声音在后台运行当我、应用程序、后台、声音

2023-09-12 08:14:01 作者:女汉子都是自己摸胸

我创造的应用程序,当我回去和我preSS home键从应用程序退出,从我的应用程序中的声音仍在运行!我必须关闭所有运行的应用程序,使之停止。

I "created" an application and when I go back or I press the home button to exit from the application, the audio from my application is still running! I have to close all running apps to make it stop.

我怎样才能停止音频跑步时,我preSS home键?

How can I stop the audio running when I press the home button?

推荐答案

当您单击后退,应用程序不断在后台运行。 如果要停止音乐任何时候你走出了一定的活动覆盖的onStop或在onPause来停止你的声音。类似的东西

When you click back, the app keeps on running in the background. If you want to stop the music any time you get out of a certain activity override onStop or onPause to stop your sound. Something like that

@Override
protected void onStop(){
    super.onStop();
    //your code for stopping the sound
}