Now, my new activity layout file is constructed with using “include” for a sections of a screen that I expect to use at least twice.
This is a details activity screen, I expect user to enter couple fields and I save data in content provider. Simple, happens in many apps. But it’s a first one for me.
Problem: Save button is pressed, I call save() and I call finish(), expecting activity to be switched to a previous one. Data apparently is saved correctly but no, instead of exiting this activity some other stuff is happening. What??
Let’s read about it.
1. Lean every day. : ) Any statement written after finish() will get executed. Interesting, but I don’t have any other statements after finish (just break, return etc).
2. OnDestroy() is a last call that activity will see before being destroyed. I guess it’s a good place to put code for back button pressed if you don’t feel like writing
3. android:noHistory = “true”. Can play with that.
I see, any code that comes after finish() is executed.
Oh, that’s right! found additional code. Finish() is not necessarily the end, more “activity” happens after the finish. Makes a joke.