Is there a way to tell if onDestroy() be called after onPause() ? In May activity, I need to do different actions when activity lost focus and when activity decreases, but even when activity decreases, onPause() is called before onDestroy() I want to perform different actions in onPause() , when the loss of focus activity and when it goes down , and onDestroy() will be called.
onDestroy()
onPause()
Yes with:
@Override protected void onPause() { super.onPause(); if (this.isFinishing()) { // WAHT YOU WANT TO DO BEFORE DESTROYING... } }
But, of course, it cannot handle it if your application crashes;)
Source: https://habr.com/ru/post/1336993/More articles:How to rewrite a header based URL? - urlcrunching serialized data and adding extra fields - php - mysql - performanceWPF printing issue - c #Rails caching: using sweepers for actions that require parameters - cachingIs there a "ZIP project" in Visual Studio? - visual-studio-2010How to get a phone number in Android - androidHTML - interrupt string in pre-tag - jqueryHow to use application settings with class libraries in winforms? - c #C # Change the connection string that exists inside the library - c #Problems with the case and sorting when my SQL Server database is installed on Latin1_General_100_CI_AI - sql-serverAll Articles