Why has TYPE_ORIENTATION been deprecated since API 8.0?

Why is TYPE_ORIENTATION deprecated since API 8.0 for ANdroid? There's a cross in eclipse, but the code works fine.

+3


source to share


3 answers


In the Google I / O 2012 conference on sensors here: http://youtu.be/Q0V_ld7iNw4?t=23m23s 23 minutes and 23 seconds later she talked about giving up this feature because on different devices like tablets and smartphones, The default orientation is landscape in tablet and portrait in tubes. If the encoder is unaware of this, it will cause their device to perform differently in those environments or when it rotates 45 degrees. Better to get the default orientation of the device first using SensorManager.getOrientation (), then do your sensor calculations accordingly.



+5


source


The depreciable code still works, but it is not guaranteed to work with future APIs. They are discounted by code that works more efficiently (and should work the same), either with different code, or in general. You should avoid deprecated code unless you really need to use it.



0


source


Because tablets usually differ from the default orientation. (It was a portrait, meaning the screen was taller than it was wide when it was normally expected. Pills mean the default is a screen that's wider than tall).

This means that you need to find the best gear that android.view.Display.getOrientation()

.

For more information see this blog post .

Deprecated

means "This has been replaced by something better. It will still work, but you should look for a new replacement because it may stop working in the future," which explains why the code "works great" "for you. It may work many years (or stop working in the next release), so you get a warning.

0


source







All Articles