Check whether the current Activity is destroyed in Android

  • 2021-11-24 03:04:13
  • OfStack

Enter the platform-tools directory in Android-sdk

Execute the following command from the command line

adb shell dumpsys activity > activity.txt

You can put the current four major components


To the activity. txt file in the current directory

Then enter the print file search:

ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)

Additional knowledge: Solution to the problem that the first Activity was destroyed when another Activity was opened

In the development, an Activity needs to be displayed in full screen by default, so after startActivity in an Activity, it is found that the last Activity has been destroyed, and the data will be requested again.

The way to set the horizontal screen here is configured in AndroidManifest. xml:

<style name="FullScreenTheme" parent="AppTheme" >
 <item name="android:windowNoTitle">true</item>
 <item name="android:windowFullscreen">true</item>


Do not use the above configuration, but in the onCreate method of Activity that requires horizontal full screen display

setContentView(R.layout.activity_main) Set the full screen by calling the following code before using the 
// Removal title

// Remove Activity The status bar above 

Related articles: