Monday, November 28, 2011

[android-developers] Re: Check for which orientations are available to the device.

Can you check if SCREEN_ORIENTATION_PORTRAIT is available to the
device in the onCreate method first?

On Nov 28, 7:28 am, karteek <kartee...@gmail.com> wrote:
> We can set orientation in our activity onCreate() method
>
> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
>
> On Nov 28, 5:36 am, XdebugX <xdeb...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I want my app to set the orientation to portrait on devices that can
> > use the portrait orientation. To do this I use
> > android:screenOrientation in the manifest. But there are some devices
> > which do not support portrait orientation (some google tv's). On
> > phones I want to set the orientation to portrait, but on tv's I'd like
> > to set the orientation unspecified. Is there a way I can check for
> > which orientations are available in the manifest (or maybe which
> > device it's running on) before I set the orientation.
>
> > Or could I set the orientation from the activity instead of from the
> > manifest?
>
> > Thanks!
>
> > Note: I want to force the orientation to portrait if it's available,
> > and I want to do it before the activity starts, like it does when you
> > set it in the manifest. Also if you just set the orientation to
> > portrait in the manifest and the device does not have a portrait
> > orientation your app will crash.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate