Last active
September 10, 2018 10:06
-
-
Save ogaclejapan/39010bbbfbd9d53574a32bcb72cd47c9 to your computer and use it in GitHub Desktop.
onStop() is not called on Nougat 7.0 - repeat next activity start and backpress several times
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
Log.d("TEST", "onCreate: $this") | |
setContentView(R.layout.activity_main) | |
findViewById<View>(R.id.test).setOnClickListener { test() } | |
} | |
override fun onStart() { | |
super.onStart() | |
Log.d("TEST", "onStart: $this") | |
} | |
override fun onResume() { | |
super.onResume() | |
Log.d("TEST", "onResume: $this") | |
} | |
override fun onPause() { | |
super.onPause() | |
Log.d("TEST", "onPause: $this") | |
} | |
override fun onStop() { | |
super.onStop() | |
Log.d("TEST", "onStop: $this") | |
} | |
override fun onDestroy() { | |
super.onDestroy() | |
Log.d("TEST", "onDestroy: $this") | |
} | |
private fun test() { | |
startActivity( | |
Intent(this, MainActivity::class.java), | |
ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle() | |
) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# emulator: system-images;android-24;google_apis;x86_64 | |
// launch | |
onCreate: com.example.MainActivity@a973caf | |
onStart: com.example.MainActivity@a973caf | |
onResume: com.example.MainActivity@a973caf | |
onPause: com.example.MainActivity@a973caf | |
// start activity | |
onCreate: com.example.MainActivity@e8f0ea1 | |
onStart: com.example.MainActivity@e8f0ea1 | |
onResume: com.example.MainActivity@e8f0ea1 | |
onPause: com.example.MainActivity@e8f0ea1 | |
// backpress | |
onResume: com.example.MainActivity@a973caf | |
onStop: com.example.MainActivity@e8f0ea1 | |
onDestroy: com.example.MainActivity@e8f0ea1 | |
// start activity | |
onPause: com.example.MainActivity@a973caf | |
onCreate: com.example.MainActivity@fb05a03 | |
onStart: com.example.MainActivity@fb05a03 | |
onResume: com.example.MainActivity@fb05a03 | |
// backpress | |
onPause: com.example.MainActivity@fb05a03 | |
onResume: com.example.MainActivity@a973caf | |
onStop: com.example.MainActivity@fb05a03 | |
onDestroy: com.example.MainActivity@fb05a03 | |
// backpress | |
onPause: com.example.MainActivity@a973caf | |
onStop: com.example.MainActivity@a973caf | |
onDestroy: com.example.MainActivity@a973caf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Base application theme. --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> | |
<item name="android:windowContentTransitions">true</item> | |
<item name="android:windowAllowEnterTransitionOverlap">true</item> | |
<item name="android:windowAllowReturnTransitionOverlap">true</item> | |
<item name="android:windowEnterTransition">@android:transition/slide_bottom</item> | |
<item name="android:windowReturnTransition">@android:transition/slide_bottom</item> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment