Skip to content Skip to sidebar Skip to footer

Android Move From Landscape To Portrait (or Vice Versa) When Using Camera Is Too Slow?

I have a DrawerLayout which contains a FrameLayout and ListView in my app, I have to show the camera in the FrameLayout, I've done that fine (as following code) and the camera work

Solution 1:

Camera.open() is an heavy operation for the system. It is only triggered when a configuration change is happening, such as when you rotate your device from landscape to portrait and vice-versa. When flipping the device (from portrait to reversed portrait, or from landscape to reversed landscape) this doesn't trigger a configuration change, only the screen rendering is flipped and therefore you don't call Camera.open() again.

So, you won't be able to make it faster (even though I recommend you to take a look at the systrace tool to see what's really happening when you rotate your screen).

But, I strongly encourage you to try calling the Camera.open() from a background Thread to avoid freezing the UI.

Post a Comment for "Android Move From Landscape To Portrait (or Vice Versa) When Using Camera Is Too Slow?"