简体   繁体   English

活动生命周期-暂停暂停

[英]Activity Lifecycle - leaving onPause to be killed

I have an android APP where I defined some of activity methods (see example below). 我有一个Android APP,其中定义了一些活动方法(请参见下面的示例)。

Is there anyway to identify when the my APP leaves onPause method to be killed due to memory required from APP with higher priority? 无论如何,由于具有更高优先级的APP需要内存,因此我的APP何时退出onPause方法而被杀死? Tnx in advanced 先进的Tnx

public class Activity extends ApplicationContext {

 private static final String TAG = "TEST";
 private static final boolean D = true;

 public void onCreate(Bundle savedInstanceState);    


 }

 public void onPause();

 super.onPause();
 if(D) Log.e(TAG, "- ON PAUSE -");

 }


 public void onStop() {

 super.onStop();
 if(D) Log.e(TAG, "- ON STOP -");

 }


 public void onDestroy();


 super.onDestroy();
 if(D) Log.e(TAG, "- ON Destroy -");

 }


 }

在此处输入图片说明

You can override Activity.onLowMemory() method. 您可以重写Activity.onLowMemory()方法。

http://developer.android.com/reference/android/app/Activity.html#onLowMemory () http://developer.android.com/reference/android/app/Activity.html#onLowMemory ()

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM