简体   繁体   English

android Kill app时会先调用onDestroy()方法吗?

[英]When the android Kill the app will onDestroy() method will be called first?

I am a beginner in Android and I want to know if i write some code in onDestroy() method and the user open another app beside this now the onPause() and onStop() will be called correct?我是 Android 的初学者,我想知道我是否在onDestroy()方法中编写了一些代码并且用户打开了另一个应用程序,现在onPause()onStop()将被调用正确吗? then if the android kill the app The onDestroy() method will be called first or not??那么如果 android杀死应用程序onDestroy()方法将首先调用还是不调用?

As a user navigates through, out of, and back to your app, the Activity instances in your app transition through different states in their lifecycle.当用户浏览、离开和返回您的应用程序时,应用程序中的 Activity 实例会在其生命周期中经历不同的状态。 The Activity class provides a number of callbacks that allow the activity to know that a state has changed: that the system is creating, stopping, or resuming an activity, or destroying the process in which the activity resides. Activity class 提供了一些回调,让 Activity 知道一个 state 发生了变化:系统正在创建、停止或恢复一个 Activity,或者销毁 Activity 所在的进程。

For this first, you need to understand the Activity Life Cycle how it actually works.首先,您需要了解 Activity Life Cycle 的实际工作原理。 在此处输入图像描述

For further details check this page .有关详细信息,请查看此页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当Android销毁活动以节省内存但不杀死App时,是否总是调用onDestroy? - Is onDestroy always called when android destroys activity to save memory but does not kill App? android休眠杀死该应用程序-onDestroy - android hibernation kill the app - onDestroy Android - 服务 - 使用强制停止时未调用 onDestroy() 方法 - Android - Service - onDestroy() method not called when using Force Stop 在模拟器中启动应用程序时调用了onDestroy - onDestroy called when starting app in emulator 为什么在切换到另一个应用程序时调用 onDestroy() - why is onDestroy() called when switching to another app onDestroy() 在活动横向模式 android 时调用 - onDestroy() called when a in activity landscape mode android Android:调用onDestroy时Asynctask无法正常工作 - Android: Asynctask not working when called onDestroy 为什么在调用onDestroy()方法后,Android概述屏幕仍显示应用程序? - Why does the Android overview screen still show an app after the onDestroy() method has been called? 在 Android Studio 中调用 onDestroy 方法时,如何在 React Native 中调用 function? - How can i call a function in React native when onDestroy method is called in Android Studio? 为什么当我们关闭应用程序时在android中只调用主要活动ondestroy - why only main activity ondestroy is called in android when we close the app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM