[android-developers] Re: Screen orientation woes
On Thu, Nov 27, 2008 at 3:29 PM, Stoyan Damov [EMAIL PROTECTED]wrote: On Fri, Nov 28, 2008 at 1:23 AM, Ralf [EMAIL PROTECTED] wrote: On Thu, Nov 27, 2008 at 11:39 AM, Stoyan Damov [EMAIL PROTECTED] wrote: I also don't want my activity to get restarted when the screen orientation changes, so I set the Config changes attribute to mcc|mnc|locale|touchscreen|keyboard||fontScale and handle onConfigurationChanged myself. That's great too. You only need to check for keyboardHidden|orientation. I don't want my app restarted when any of these settings change - e.g. I don't care if user switched locale, MCC, MNC, etc. Please don't do this. If, when your app is restarted due to these changes, it to breaks, then it will also break when the user moves to another app and then returns to yours and it needs to be restarted. There is simply no reason to do this kind of thing except to hide bugs in your app, which users will eventually encounter. As far as finding out if the user tried to put your app in an orientation it is not allowing... no, there is no way to do this, because you are forcing a particular orientation, so actually the orientation didn't change at all. And actually, I'd have to wonder, if you are forcing the orientation one way, does it really make sense to show a different UI if the orientation might have changed? I mean, if you are forcing portrait, and the user opens the G1 keyboard, and... well, the screen stays portrait. Your app still works. Why tell them they can't use it when they happen to have the keyboard open? Likewise if on some device the orientation is controlled by the accelerometer, why tell them they can't use your app if they happen to have the screen angled a certain way? -- Dianne Hackborn Android framework engineer [EMAIL PROTECTED] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Screen orientation woes
On a side note, I read here[1] that I can set the orientation to sensor, which will report screen orientation changes as the device's physical orientation changes. Does this really work on a real device (I still don't have one) or that's reserved for a future release? Yes, it works. http://androidguys.com/?p=2914 I'm asking because from what I read in some G1 reviews, the device's screen orientation changes to landscape only when the user slides the keyboard open. That's true, in that the default for screenOrientation goes by the keyboard. But, if you use sensor instead, it will rotate based on movement alone. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.4 Published! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Screen orientation woes
Aha, that's very good to know, thanks Mark! :) On Thu, Nov 27, 2008 at 9:42 PM, Mark Murphy [EMAIL PROTECTED] wrote: On a side note, I read here[1] that I can set the orientation to sensor, which will report screen orientation changes as the device's physical orientation changes. Does this really work on a real device (I still don't have one) or that's reserved for a future release? Yes, it works. http://androidguys.com/?p=2914 I'm asking because from what I read in some G1 reviews, the device's screen orientation changes to landscape only when the user slides the keyboard open. That's true, in that the default for screenOrientation goes by the keyboard. But, if you use sensor instead, it will rotate based on movement alone. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.4 Published! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Screen orientation woes
On Thu, Nov 27, 2008 at 11:39 AM, Stoyan Damov [EMAIL PROTECTED] wrote: Hi all, For my app the landscape orientation is useless, so I set my activity's Screen orientation attribute to portrait. Even when the screen orientation changes to landscape, whatever I draw is simply drawn flipped 90 degrees, which is what I want. I also don't want my activity to get restarted when the screen orientation changes, so I set the Config changes attribute to mcc|mnc|locale|touchscreen|keyboard||fontScale and handle onConfigurationChanged myself. That's great too. You only need to check for keyboardHidden|orientation. Now, the thing is, that when onConfigurationChanged gets called, the orientation is always reported as portrait, while I really want to know that the user has changed it to landscape, so I can put a message saying something like landscape orientation is not supported. Is there a way to do that? Is there a way in which I can query the device for it's physical orientation? Try using android.view.OrientationListener. R/ On a side note, I read here[1] that I can set the orientation to sensor, which will report screen orientation changes as the device's physical orientation changes. Does this really work on a real device (I still don't have one) or that's reserved for a future release? I'm asking because from what I read in some G1 reviews, the device's screen orientation changes to landscape only when the user slides the keyboard open. FWIW I'm using SDK 1.0 r1. Thanks, Stoyan [1] http://code.google.com/android/reference/android/R.styleable.html#AndroidManifestActivity_screenOrientation --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Screen orientation woes
On Fri, Nov 28, 2008 at 1:23 AM, Ralf [EMAIL PROTECTED] wrote: On Thu, Nov 27, 2008 at 11:39 AM, Stoyan Damov [EMAIL PROTECTED] wrote: I also don't want my activity to get restarted when the screen orientation changes, so I set the Config changes attribute to mcc|mnc|locale|touchscreen|keyboard||fontScale and handle onConfigurationChanged myself. That's great too. You only need to check for keyboardHidden|orientation. I don't want my app restarted when any of these settings change - e.g. I don't care if user switched locale, MCC, MNC, etc. Now, the thing is, that when onConfigurationChanged gets called, the orientation is always reported as portrait, while I really want to know that the user has changed it to landscape, so I can put a message saying something like landscape orientation is not supported. Is there a way to do that? Is there a way in which I can query the device for it's physical orientation? Try using android.view.OrientationListener. Thanks, I'll take a look! Cheers --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---