如何隐藏我的应用程序,但不会关闭/完成它 [英] How to hide my application but not close/finish it
问题描述
我想,让用户通过隐藏,但没有完成它离开我的应用程序。
I would like to let user to leave my application by hiding it but not finishing it.
我可以调用finish()在我的主要活动,但它需要一些时间来做到这一点。这不是很好的用户体验,从而更好的选择可能是将其隐藏。只是我不知道如何去实现它。
I could call finish() in my main activity, but it takes some time to do that. It's not good for user experience, therefore a better choice might be to hide it. Just I don't know how to achieve it.
感谢所有的答案。
我没有试图做一些事情的背景,因为我已经有一个服务。
I am not trying to do something in the background, because I already have a service.
在我的应用程序,用户可能preSS的按钮,关闭我的主要活动。然而,这需要一点时间来做到这一点。在经过0.5秒以上,然后我会在屏幕上看到我的应用程序中消失。
In my application, user might press an button to close my main activity. However, it take a little time to do that. At least after 0.5 sec, then I'll see my application disappear on screen.
不过,如果我preSS home键。我的应用程序是马上消失,所以这是我需要的效果。
However, if I press home key. My application is disappear immediately, so it's the effect I need.
推荐答案
您可以尝试将您的活动的背景
You could try to move your activity in the background
moveTaskToBack(true);
这篇关于如何隐藏我的应用程序,但不会关闭/完成它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!