Reputation: 2119
I have an app that requires fairly substantial initialization (CPU-wise, not memory). When the user hits the back button, I'd prefer to leave the hard computations and allocated structures intact so there is no 3-4 second delay every time they hit the icon.
What is the proper way to do this? Should part of the app be a service?
Upvotes: 0
Views: 37
Reputation: 1858
Decouple your UI and core logic. Since you want your application keep running in the background implement a service component and maintain the state of your native library initialisation and other stuff which you wanted to be available for the UI. Service plus a state machine approach will give you better benefit in such cases.
Upvotes: 1