I'm relatively new to programming and I am having troubles with an orientation change. I would be thankful for any thoughts.
This is a specific question about the official android documentation, please do not report this question as a duplicate and show me a generic handling runtime thread.
After reading the documentation, I am not sure about the part quoted below.
My question: If I have a timer that shows the current value in a TextView, does this mean I should not use a fragmant to retain the object at all?
Or does it simply mean I should detach the fragmant from the activity entirely?
Android documentation:
Caution: While you can store any object, you should never pass an object that is tied to the Activity, such as a Drawable, an Adapter, a View or any other object that's associated with a Context. If you do, it will leak all the views and resources of the original activity instance. (Leaking resources means that your application maintains a hold on them and they cannot be garbage-collected, so lots of memory can be lost.)
https://developer.android.com/guide/topics/resources/runtime-changes.html#RetainingAnObject
Background information:
My app: (several) interval timers.
I would like to retain the display of the timer if an orientation change occurs during runtime.
I used a hacky solution in the manifestation at first but it lead to problems so figured why not try to solve the problem cleanly.
If I cannot get it done, then most likely I will let the user decide which orientation she or he prefers and then fix it during the runtime of the timer.