当我退出应用程序时,声音在后台运行

编程入门 行业动态 更新时间:2024-10-28 20:26:09
本文介绍了当我退出应用程序时,声音在后台运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建"了一个应用程序,当我返回或按主页按钮退出应用程序时,我的应用程序中的音频仍在运行!我必须关闭所有正在运行的应用才能让它停止.

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.

如何在按下主页按钮时停止音频运行?

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 }

更多推荐

当我退出应用程序时,声音在后台运行

本文发布于:2023-11-27 04:55:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636689.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:当我   应用程序   后台   声音

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!