Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

OnSave/RestoreInstanceState by back button pressing not called but destroyed

$
0
0

Hello Everyone!

I realized that i don't understand perfectly the activity lifecycle or something wrong. I have 3 actvitity. Main activity and two alternative activity which are reachable through the menu. The first menu item is Configuration and the other is the Storing. I need one configuration item to be setted(e-mail address). I am going to the Storing activity. There is a listview with a button. In the listview there are custom listview items. A checkbox with textview. I check some list items and click the button. I want to send the checked listview items (files) send to an e-mail address what i specified in the configuration activity. I checked the neccessary thing before send e-mail. Is wifi connected, i am online, e-mail address is specified, checked minimum one file and so one. If the e-mail is empty then i must navigate back to the main form with back button and then press the menu button and choose "Configuration". There i specify the e-mail address, press back button to the main activity again and hit the menu button again and navigate to the "Storing" activity. I know it is a little complicated. But i want to store the checking in the listview. I checked that the OnPause(), OnStop() and OnDestroy() called but when i want to save the checkings the OnSaveInstanceState() and OnRestoreInstanceState() don't called. I know that if the activity not destroyed it holds his status. On this layout if the wifi not connected i call an activity (ActionWifiSettings) to choose the user a connection. After that i navigate back to the Storing activity and the checkings are fine. I don't want to let the activity to destroy itself but it do it. I think if the OnCreate() call only once it would be good. But every back button the OnDestroy() is called. I don't push the home button, just the back button. I stay in the application. When i navigate to the Storing activity i want to see the previously checked files. In this application is running a service too. If i close this application and the service running it is okay, that the application forget the checked files, but if this application run in background, i don't want to let.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>