Question

I have an android app designed using codename one

1)I run my application

2)I click on the home button of the phone.My app is taken away from my app and home screen is shown to me.

3)I again click on my application after navigating to it from the menu.

I expect that the state of my application be restored. But what happens is, my application restarts.

Also, this behaviour is arbitrary. Sometimes the application restarts and at other times the application resumes its state. Most of the times it restarts.

How do i ensure that my application always resumes its old state?

Was it helpful?

Solution

Android restarts running applications on some conditions to preserve RAM, battery etc. If you use the task switcher the application will resume properly but relaunching it often restarts it.

We are working on improving this behavior in the next update to Codename One, but you can use the stop method to store the application state into storage and use the start method to restore the application state.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top