应用程序最小化时运行代码的最佳方式? [英] Best way of running code when the app is minimized?

查看:94
本文介绍了应用程序最小化时运行代码的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在后台运行代码有不同的方法,但我想知道以下场景的最佳方法是什么:

There are different ways of running code in the background, but I'm wondering what would be the best way for the following scenario:

一旦用户点击我的应用程序中的按钮,我基本上想要运行一段代码(它是一个while循环,因此只有在用户选择这样做时才会停止)。一旦用户最小化应用程序,它应该继续运行,直到用户打开应用程序并停止它。

I basically want to run a piece of code (its a while loop, so it will only stops if the users chooses to do so) once the user click on a button in my app. Once the user minimizes the app it should continue to run until the user opens the app and stops it.

最好的方法是什么?误用媒体播放器的东西?

What is the best way to do this? Mis-using the mediaplayer stuff?

Niels

推荐答案

抱歉,我无法理解你的问题,你想做什么。

Sorry, I cannot understand your question, what you want to do.

你想通过用户的互动来开始和停止播放声音吗?

Do you want to start and stop play sound by user's interaction?

我认为你应该订购/安排你的问题。

I think you should make your issue ordered/arranged.


这篇关于应用程序最小化时运行代码的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆