在Kivy中处理Android上的应用程序挂起/恢复

2024-04-19 11:47:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我开始用kivyforandroid开发一个应用程序,今天成功地构建并运行了一个APK。在

在没有经过初始化/加载屏幕的情况下,如何处理用户挂起和恢复我的应用程序,找不到直接的答案?有没有一种特殊的机制来处理这个问题?在

令人讨厌的是,每次我将应用程序发送到后台并将焦点放回它时,都会弹出加载屏幕。在


Tags: 答案用户应用程序屏幕情况后台机制apk
2条回答

我从未使用过Kivy或为android开发过,但我发现:

This

从链接:

If you just want your app to not be closed completely (so that it doesn't restart entirely with the splash screen etc. every time), you just have to add an on_pause method to your App class, and it should return True. You can also do any pre-pause stuff in this method. However, the app doesn't really keep running, it just keeps memory state.

如果你想让它在后台进行计算,你可以使用pythonforandroid。在

Kivy有一个^{}^{}方法,可以用来处理这些事件。这些是为您自动调用的主App类的方法。在

相关问题 更多 >