I'm developing an application in two languages (Arabic and English), When the user press on a Button in the first activity it views another activity contains (Timer, array of strings and many different values)
When the user change between portrait and landscape the values lost, How to handle this problem (Keeping the values and the objects)
Kind Regards,
When you rotate a device your activity is restarted. To avoid this, you must handle the orientation change yourself. To do this, you must add the configuration to your manifest XML (android:configChanges) and override the onConfigurationChanged function in your activity.
Here's an example from the Android documentation. Implementing this will allow you to retain the state (and variables) in your activity during an orientation change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With