Search code examples
androiduser-interfaceorientationreload

Reload only UI, not main view on an Android app


I'm making a video app in Android Studio and having problem with moving between profile and landscape orientation where the whole activity is being reloaded.

I want only to reload the UI layout while flipping the phone without having to reload the main View that streams my video from my main Activity. I have two layout, one for profile and one for landscape (in each respective catalog; layout and layout-land), and they're being reloaded correctly on tilting the phone. But how do I still keep the video from playing without reloading with the main activity?

I've tried to look into Fragments, but it only keep the UI element from not being reloaded and not the main activity. Am I missing something fundamental here?


Solution

  • This is what you are looking for. It is a demo project on github.

    Also, look into this and this on SO.