finish()/onDestroy() is not being called for every activity.
See original GitHub issueThis might not be a bug - (but I didn’t see it documented anywhere) Is finish()
/onDestroy()
guaranteed to be called on every Activity started by ActivityTestRule, specifically in order? I’m seeing cases where onDestroy()
is called, but the activity that’s returning isn’t being finished via isFinishing()
.
Some logs that show my findings: (@Before
and @After
are junit before/after methods)
D/OrderOfOp: @Before
D/OrderOfOp: @After
D/OrderOfOp: onPause()
D/OrderOfOp: @Before
D/OrderOfOp: onDestroy()
D/OrderOfOp: onDestroy() --> isFinishing()
D/OrderOfOp: @After
D/OrderOfOp: onPause()
D/OrderOfOp: @Before
D/OrderOfOp: @After
D/OrderOfOp: onPause()
D/OrderOfOp: @Before
D/OrderOfOp: onDestroy()
D/OrderOfOp: onDestroy() --> isFinishing()
D/OrderOfOp: onPause()
D/OrderOfOp: onDestroy()
D/OrderOfOp: onDestroy() --> isFinishing()
(for reference, this is the onDestroy() method):
@Override
protected void onDestroy() {
super.onDestroy();
Log.d("OrderOfOp", "onDestroy()");
if (isFinishing()) {
Log.d("OrderOfOp", "onDestroy() --> isFinishing()");
}
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top Results From Across the Web
Android: Will finish() ALWAYS call onDestroy()? - Stack Overflow
Third, finish() does not call onDestroy() . You can tell that by reading the source code. finish() usually triggers a call to onDestroy()...
Read more >Android activity Lifecycle. An activity is a single, focused thing…
If the activity is finishing, onDestroy() is the final lifecycle callback the activity receives. If onDestroy() is called as the result of a...
Read more >The activity lifecycle - Android Developers
An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial...
Read more >4. The Activity Lifecycle: Being an Activity - Head First Android ...
The onDestroy() method is the final call you get before the activity is destroyed. There are a number of situations in which an...
Read more >Activity Lifecycle | CodePath Android Cliffnotes
onDestroy(), Counterpart to onCreate(...) . This can be triggered because finish() was called on the activity or the system needed to free up...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This has been addressed in the next release!
Is there any release date for 0.6? The last version as of now was 0.5 from 2016-02-22