Android Studio - Data Lossing when the application restarts/moving to another activity. #255
Replies: 1 comment
-
If the activity is restarting then all states will be set to its default just like what you would want when the activity starts for the first time. One way to save the state is to well save the state in the onSaveInstanceState method of the activity. In your onCreate method you can get what you saved which in turn you can use to restore your state Warning --this just save the state while the app is running or in the background. If the app is killed and then restarted all states will be set to its default my advice will be to save the state of the app on a server since it's a delivery app and you will want to have a copy of what the user ordered |
Beta Was this translation helpful? Give feedback.
-
I have a trouble! Please anyone help on this! I'm currently doing a food application for my college! Now the - problem is when ever I click the add button!
**SAMPLE: **
Screenshot_2022-08-16-21-41-36-11_5bc418c57209d4c065228a8244aa2e83.jpg
Logically it's just working fine! But when ever I go to another activity or cart activity and came back to the the home activity it's not showing the current status of the food item!
**Before go to another activity: **
Screenshot_2022-08-16-21-44-24-93_5bc418c57209d4c065228a8244aa2e83.jpg
**After gone to another activity: **
Please somebody help me! Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions