This is probably a beginner question, but I’ve already tried looking for an answer and couldn’t find one. I was testing an Android app I made on my phone and it was working fine until I switched from portrait to landscape, just to see what would happen. It pretty much made the app go back to the home page, so I’m guessing it calls onCreate() every time the orientation changes. Is it possible to prevent an orientation change from restarting everything, and just have it switch all the views to fit landscape or portrait mode?
This is probably a beginner question, but I’ve already tried looking for an answer
Share
This question has been answered thousand times, but …
You should add in you Manifest.xml for your activity
android:configChange="orientation"and then override
onConfigurationChanged(newConfig)method and do not add anything inside, since you are telling you app to do nothing when config changes occur.