Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在调用 onDestory() 时,应用程序在后台运行...并且静态成员与之前访问应用程序时保持相同...它们必须在调用 onDestroy() 时被销毁
onDestroy 会破坏当前活动还是整个应用程序?
如果您不需要活动生命周期之外的对象,则将它们设为成员变量。
否则,当“应用程序”(即应用程序类)被销毁时,它们将被销毁。
Activity 的 onDestroy 在 Activity 结束时运行。应用程序可能会或可能不会完全从内存中删除,具体取决于系统的内存使用情况以及应用程序中仍在运行的其他活动/服务。