简体   繁体   中英

Save button in Activity of android application?

I know that this question has been resolved in many other threads for example: Saving Android Activity state using Save Instance State I know that the onSaveInstance(Bundle bundle) method is called, but it is always called from the system. I would like to call it when the user presses a button. The only problem as far as I know is that you don't have the reference to the Bundle that is needed to store your bundle. Thanks in advance

Depending on how you need to save your application state, why do you want to use that method and a Bundle? Can you not persist it using SharedPreferences and then load them on resume?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM