[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
On Oct 31, 6:00 pm, Dianne Hackborn wrote: > I'll make this a little stronger -- the Display object is LOW LEVEL access > to the display. > (The Display object clearly needs a lot more documentation... but this is a > pretty low priority because, again, it really shouldn't be used by > applications.) I was just reviewing this thread in light of some of my own orientation-related code, and found this comment striking. Don't you think perhaps it might be a pretty *high* priority to at least update the Display documentation to say the above, and point the reader to the Configuration class instead? I had been using Display in just the way I apparently shouldn't have, specifically because nothing in the docs warned me off it. String -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Well the user who tested my old version and new version of the orientation code was running a standard build of Android. I also know at least one other user was also running standard 1.5 and not any unofficial ROM. Can anyone else shed any light on what may be causing this? I cant believe this issue hasn't caused other people problems, surely if an app works on one device it should work on all? On Nov 2, 1:21 am, niko20 wrote: > I wouldn't be surprised if these people are running Cyanogen mods. > People also had problems with my app when they did that. In my opinion > custom ROMS are trouble for developers. > > -niko > > On Nov 1, 6:31 pm, mscwd01 wrote: > > > > > Hey Mark, > > > I have had one user contact me by email and he had the same issues > > using the older version and the new version (using the orientation > > code you supplied), so I can rule out that being the cause *I think*. > > > I *presume* it isn't a ROM issue as I have had 8-10 users leave > > comments saying it doesn't work, in each comment they say "recent > > update doesn't solve the issue". I guess for most people it may work > > and they dont bother leaving a message which says "hey it works" > > instead its only the people having problems who post negative > > comments. > > > I have tried every test case such as holding the phone in different > > orientations when starting the activity and had no luck finding a bug > > there, in fact I have wasted far too many hours on this. > > > On Nov 2, 12:17 am, Mark Murphy wrote: > > > > Phy wrote: > > > > I have confirmation from five users who either have a HTC G1 or HTC > > > > Magic who say my application works fine. However, I have had numerous > > > > recent comments on the Market that the orientation of my applications > > > > interface is rotated 90 degrees on G1/Magic devices. > > > > Do you have any confirmation from any users who are seeing the rotation > > > problem? (i.e., direct email, not Market comments) > > > > > I use this method to get the screen orientation: > > > > getResources().getConfiguration().orientation; > > > > That's not what you used to do, by your own admission. Are you sure that > > > the comments are from people who are using your newer version? > > > > And, again, do you have any confirmation from any users who are seeing > > > the rotation problem? > > > > > How can this work fine on some phones and completely break on other > > > > peoples phones which are the same make and model? > > > > It could be they are running the older version of your application. Or, > > > it could be a ROM version difference, with a bug in some ROMs. Or, it > > > could be something about the way some users are using your app that > > > differs from your expectations and test cases (e.g., they open the app > > > starting in landscape mode, and you expect them to be starting in > > > portrait mode). > > > > Please bear in mind that, across a 13-post thread, you have not once > > > actually indicated what app this is, AFAICT. > > > > -- > > > Mark Murphy (a Commons > > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > > Android App Developer Books:http://commonsware.com/books- Hide quoted > > > text - > > - Show quoted text - -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
I wouldn't be surprised if these people are running Cyanogen mods. People also had problems with my app when they did that. In my opinion custom ROMS are trouble for developers. -niko On Nov 1, 6:31 pm, mscwd01 wrote: > Hey Mark, > > I have had one user contact me by email and he had the same issues > using the older version and the new version (using the orientation > code you supplied), so I can rule out that being the cause *I think*. > > I *presume* it isn't a ROM issue as I have had 8-10 users leave > comments saying it doesn't work, in each comment they say "recent > update doesn't solve the issue". I guess for most people it may work > and they dont bother leaving a message which says "hey it works" > instead its only the people having problems who post negative > comments. > > I have tried every test case such as holding the phone in different > orientations when starting the activity and had no luck finding a bug > there, in fact I have wasted far too many hours on this. > > On Nov 2, 12:17 am, Mark Murphy wrote: > > > Phy wrote: > > > I have confirmation from five users who either have a HTC G1 or HTC > > > Magic who say my application works fine. However, I have had numerous > > > recent comments on the Market that the orientation of my applications > > > interface is rotated 90 degrees on G1/Magic devices. > > > Do you have any confirmation from any users who are seeing the rotation > > problem? (i.e., direct email, not Market comments) > > > > I use this method to get the screen orientation: > > > getResources().getConfiguration().orientation; > > > That's not what you used to do, by your own admission. Are you sure that > > the comments are from people who are using your newer version? > > > And, again, do you have any confirmation from any users who are seeing > > the rotation problem? > > > > How can this work fine on some phones and completely break on other > > > peoples phones which are the same make and model? > > > It could be they are running the older version of your application. Or, > > it could be a ROM version difference, with a bug in some ROMs. Or, it > > could be something about the way some users are using your app that > > differs from your expectations and test cases (e.g., they open the app > > starting in landscape mode, and you expect them to be starting in > > portrait mode). > > > Please bear in mind that, across a 13-post thread, you have not once > > actually indicated what app this is, AFAICT. > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Android App Developer Books:http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Hey Mark, I have had one user contact me by email and he had the same issues using the older version and the new version (using the orientation code you supplied), so I can rule out that being the cause *I think*. I *presume* it isn't a ROM issue as I have had 8-10 users leave comments saying it doesn't work, in each comment they say "recent update doesn't solve the issue". I guess for most people it may work and they dont bother leaving a message which says "hey it works" instead its only the people having problems who post negative comments. I have tried every test case such as holding the phone in different orientations when starting the activity and had no luck finding a bug there, in fact I have wasted far too many hours on this. On Nov 2, 12:17 am, Mark Murphy wrote: > Phy wrote: > > I have confirmation from five users who either have a HTC G1 or HTC > > Magic who say my application works fine. However, I have had numerous > > recent comments on the Market that the orientation of my applications > > interface is rotated 90 degrees on G1/Magic devices. > > Do you have any confirmation from any users who are seeing the rotation > problem? (i.e., direct email, not Market comments) > > > I use this method to get the screen orientation: > > getResources().getConfiguration().orientation; > > That's not what you used to do, by your own admission. Are you sure that > the comments are from people who are using your newer version? > > And, again, do you have any confirmation from any users who are seeing > the rotation problem? > > > How can this work fine on some phones and completely break on other > > peoples phones which are the same make and model? > > It could be they are running the older version of your application. Or, > it could be a ROM version difference, with a bug in some ROMs. Or, it > could be something about the way some users are using your app that > differs from your expectations and test cases (e.g., they open the app > starting in landscape mode, and you expect them to be starting in > portrait mode). > > Please bear in mind that, across a 13-post thread, you have not once > actually indicated what app this is, AFAICT. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android App Developer Books:http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Phy wrote: > I have confirmation from five users who either have a HTC G1 or HTC > Magic who say my application works fine. However, I have had numerous > recent comments on the Market that the orientation of my applications > interface is rotated 90 degrees on G1/Magic devices. Do you have any confirmation from any users who are seeing the rotation problem? (i.e., direct email, not Market comments) > I use this method to get the screen orientation: > getResources().getConfiguration().orientation; That's not what you used to do, by your own admission. Are you sure that the comments are from people who are using your newer version? And, again, do you have any confirmation from any users who are seeing the rotation problem? > How can this work fine on some phones and completely break on other > peoples phones which are the same make and model? It could be they are running the older version of your application. Or, it could be a ROM version difference, with a bug in some ROMs. Or, it could be something about the way some users are using your app that differs from your expectations and test cases (e.g., they open the app starting in landscape mode, and you expect them to be starting in portrait mode). Please bear in mind that, across a 13-post thread, you have not once actually indicated what app this is, AFAICT. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Okay can I just summarise my problem as I believe it is an issue which NEEDS to be addressed... I have confirmation from five users who either have a HTC G1 or HTC Magic who say my application works fine. However, I have had numerous recent comments on the Market that the orientation of my applications interface is rotated 90 degrees on G1/Magic devices. I use this method to get the screen orientation: getResources().getConfiguration().orientation; and remap the coordinate system as follows before drawing the application interface: if(screenOrientation == 1) { // Portrait SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z, SensorManager.AXIS_X, outR); } else { // All other send to Landscape SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, SensorManager.AXIS_Z, outR); } How can this work fine on some phones and completely break on other peoples phones which are the same make and model? This is really disconcerting, and needs to be explained. On Nov 1, 11:06 pm, mscwd01 wrote: > Well Niko that may be true but it doesn't change the fact that it > works fine on an HTC Hero and some G1 & Magic phones. > > It should either work or not, having your application work fine on > some devices and break on other devices is rediculous and its getting > annoying now. > > iPhone here I come :( > > On Nov 1, 3:18 am, niko20 wrote: > > > Wait- > > > YOu are remapping the coords after rotation? Well then that's where > > the problem has to be, since clearly Mark has shown that the > > getOrientation() works correctly > > > -niko > > > On Oct 31, 1:25 pm, mscwd01 wrote: > > > > Well then this is extremely confusing! > > > > Firstly, thanks Mark for taking the time to test it. > > > > The only other thing which could be wrong is how the coordinate system > > > is represented in each device. I draw to the screen once I have > > > remapped the coordinate system i.e.: > > > > if(screenOrientation == 1) { // Portrait > > > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z, > > > SensorManager.AXIS_X, outR);} > > > > else { // All other send to Landscape > > > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, > > > SensorManager.AXIS_Z, outR); > > > > } > > > > However, this shouldn't be an issue should it? > > > > On Oct 31, 6:19 pm, Mark Murphy wrote: > > > > > mscwd01 wrote: > > > > > Okay this is getting really rather annoying now. > > > > > > I have used both of the following methods of getting the screen > > > > > orientation and both do not work properly on different devices. > > > > > > Method 1: > > > > > Display display = ((WindowManager) getSystemService > > > > > (WINDOW_SERVICE)).getDefaultDisplay(); > > > > > int screenOrientation = display.getOrientation(); > > > > > > Method 2: > > > > > int screenOrientation = getResources().getConfiguration().orientation; > > > > > > Both methods work fine on the HTC Hero; however, they both fail on the > > > > > G1 and G2 devices (according to the users of my app). > > > > > > How can we be expected to make high quality applications if the API is > > > > > not supported on all devices??? > > > > > > I would be very greatful if someone could offer a solution to this, > > > > > its just not acceptable. > > > > > I just tested this on a G1, and > > > > getResources().getConfiguration().orientation is 2 in landscape and 1 in > > > > portrait, just like it should be. > > > > > I also tested it on an HTC Magic, and it works just fine. > > > > > Heck, it even works on an ARCHOS 5 Android tablet. > > > > > -- > > > > Mark Murphy (a Commons > > > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > > > Android Development Wiki:http://wiki.andmob.org -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Okay can I just summarise my problem as I believe it is an issue which NEEDS to be addressed... I have confirmation from five users who either have a HTC G1 or HTC Magic who say my application works fine. However, I have had numerous recent comments on the Market that the orientation of my applications interface is rotated 90 degrees on G1/Magic devices. I use this method to get the screen orientation: getResources().getConfiguration().orientation; and remap the coordinate system as follows before drawing the application interface: if(screenOrientation == 1) { // Portrait SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z, SensorManager.AXIS_X, outR); } else { // All other send to Landscape SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, SensorManager.AXIS_Z, outR); } How can this work fine on some phones and completely break on other peoples phones which are the same make and model? This is really disconcerting, and needs to be explained. On Nov 1, 11:06 pm, mscwd01 wrote: > Well Niko that may be true but it doesn't change the fact that it > works fine on an HTC Hero and some G1 & Magic phones. > > It should either work or not, having your application work fine on > some devices and break on other devices is rediculous and its getting > annoying now. > > iPhone here I come :( > > On Nov 1, 3:18 am, niko20 wrote: > > > Wait- > > > YOu are remapping the coords after rotation? Well then that's where > > the problem has to be, since clearly Mark has shown that the > > getOrientation() works correctly > > > -niko > > > On Oct 31, 1:25 pm, mscwd01 wrote: > > > > Well then this is extremely confusing! > > > > Firstly, thanks Mark for taking the time to test it. > > > > The only other thing which could be wrong is how the coordinate system > > > is represented in each device. I draw to the screen once I have > > > remapped the coordinate system i.e.: > > > > if(screenOrientation == 1) { // Portrait > > > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z, > > > SensorManager.AXIS_X, outR);} > > > > else { // All other send to Landscape > > > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, > > > SensorManager.AXIS_Z, outR); > > > > } > > > > However, this shouldn't be an issue should it? > > > > On Oct 31, 6:19 pm, Mark Murphy wrote: > > > > > mscwd01 wrote: > > > > > Okay this is getting really rather annoying now. > > > > > > I have used both of the following methods of getting the screen > > > > > orientation and both do not work properly on different devices. > > > > > > Method 1: > > > > > Display display = ((WindowManager) getSystemService > > > > > (WINDOW_SERVICE)).getDefaultDisplay(); > > > > > int screenOrientation = display.getOrientation(); > > > > > > Method 2: > > > > > int screenOrientation = getResources().getConfiguration().orientation; > > > > > > Both methods work fine on the HTC Hero; however, they both fail on the > > > > > G1 and G2 devices (according to the users of my app). > > > > > > How can we be expected to make high quality applications if the API is > > > > > not supported on all devices??? > > > > > > I would be very greatful if someone could offer a solution to this, > > > > > its just not acceptable. > > > > > I just tested this on a G1, and > > > > getResources().getConfiguration().orientation is 2 in landscape and 1 in > > > > portrait, just like it should be. > > > > > I also tested it on an HTC Magic, and it works just fine. > > > > > Heck, it even works on an ARCHOS 5 Android tablet. > > > > > -- > > > > Mark Murphy (a Commons > > > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > > > Android Development Wiki:http://wiki.andmob.org -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Well Niko that may be true but it doesn't change the fact that it works fine on an HTC Hero and some G1 & Magic phones. It should either work or not, having your application work fine on some devices and break on other devices is rediculous and its getting annoying now. iPhone here I come :( On Nov 1, 3:18 am, niko20 wrote: > Wait- > > YOu are remapping the coords after rotation? Well then that's where > the problem has to be, since clearly Mark has shown that the > getOrientation() works correctly > > -niko > > On Oct 31, 1:25 pm, mscwd01 wrote: > > > Well then this is extremely confusing! > > > Firstly, thanks Mark for taking the time to test it. > > > The only other thing which could be wrong is how the coordinate system > > is represented in each device. I draw to the screen once I have > > remapped the coordinate system i.e.: > > > if(screenOrientation == 1) { // Portrait > > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z, > > SensorManager.AXIS_X, outR);} > > > else { // All other send to Landscape > > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, > > SensorManager.AXIS_Z, outR); > > > } > > > However, this shouldn't be an issue should it? > > > On Oct 31, 6:19 pm, Mark Murphy wrote: > > > > mscwd01 wrote: > > > > Okay this is getting really rather annoying now. > > > > > I have used both of the following methods of getting the screen > > > > orientation and both do not work properly on different devices. > > > > > Method 1: > > > > Display display = ((WindowManager) getSystemService > > > > (WINDOW_SERVICE)).getDefaultDisplay(); > > > > int screenOrientation = display.getOrientation(); > > > > > Method 2: > > > > int screenOrientation = getResources().getConfiguration().orientation; > > > > > Both methods work fine on the HTC Hero; however, they both fail on the > > > > G1 and G2 devices (according to the users of my app). > > > > > How can we be expected to make high quality applications if the API is > > > > not supported on all devices??? > > > > > I would be very greatful if someone could offer a solution to this, > > > > its just not acceptable. > > > > I just tested this on a G1, and > > > getResources().getConfiguration().orientation is 2 in landscape and 1 in > > > portrait, just like it should be. > > > > I also tested it on an HTC Magic, and it works just fine. > > > > Heck, it even works on an ARCHOS 5 Android tablet. > > > > -- > > > Mark Murphy (a Commons > > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > > Android Development Wiki:http://wiki.andmob.org -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Wait- YOu are remapping the coords after rotation? Well then that's where the problem has to be, since clearly Mark has shown that the getOrientation() works correctly -niko On Oct 31, 1:25 pm, mscwd01 wrote: > Well then this is extremely confusing! > > Firstly, thanks Mark for taking the time to test it. > > The only other thing which could be wrong is how the coordinate system > is represented in each device. I draw to the screen once I have > remapped the coordinate system i.e.: > > if(screenOrientation == 1) { // Portrait > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z, > SensorManager.AXIS_X, outR);} > > else { // All other send to Landscape > SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, > SensorManager.AXIS_Z, outR); > > } > > However, this shouldn't be an issue should it? > > On Oct 31, 6:19 pm, Mark Murphy wrote: > > > mscwd01 wrote: > > > Okay this is getting really rather annoying now. > > > > I have used both of the following methods of getting the screen > > > orientation and both do not work properly on different devices. > > > > Method 1: > > > Display display = ((WindowManager) getSystemService > > > (WINDOW_SERVICE)).getDefaultDisplay(); > > > int screenOrientation = display.getOrientation(); > > > > Method 2: > > > int screenOrientation = getResources().getConfiguration().orientation; > > > > Both methods work fine on the HTC Hero; however, they both fail on the > > > G1 and G2 devices (according to the users of my app). > > > > How can we be expected to make high quality applications if the API is > > > not supported on all devices??? > > > > I would be very greatful if someone could offer a solution to this, > > > its just not acceptable. > > > I just tested this on a G1, and > > getResources().getConfiguration().orientation is 2 in landscape and 1 in > > portrait, just like it should be. > > > I also tested it on an HTC Magic, and it works just fine. > > > Heck, it even works on an ARCHOS 5 Android tablet. > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Android Development Wiki:http://wiki.andmob.org -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Well then this is extremely confusing! Firstly, thanks Mark for taking the time to test it. The only other thing which could be wrong is how the coordinate system is represented in each device. I draw to the screen once I have remapped the coordinate system i.e.: if(screenOrientation == 1) { // Portrait SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z, SensorManager.AXIS_X, outR); } else { // All other send to Landscape SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, SensorManager.AXIS_Z, outR); } However, this shouldn't be an issue should it? On Oct 31, 6:19 pm, Mark Murphy wrote: > mscwd01 wrote: > > Okay this is getting really rather annoying now. > > > I have used both of the following methods of getting the screen > > orientation and both do not work properly on different devices. > > > Method 1: > > Display display = ((WindowManager) getSystemService > > (WINDOW_SERVICE)).getDefaultDisplay(); > > int screenOrientation = display.getOrientation(); > > > Method 2: > > int screenOrientation = getResources().getConfiguration().orientation; > > > Both methods work fine on the HTC Hero; however, they both fail on the > > G1 and G2 devices (according to the users of my app). > > > How can we be expected to make high quality applications if the API is > > not supported on all devices??? > > > I would be very greatful if someone could offer a solution to this, > > its just not acceptable. > > I just tested this on a G1, and > getResources().getConfiguration().orientation is 2 in landscape and 1 in > portrait, just like it should be. > > I also tested it on an HTC Magic, and it works just fine. > > Heck, it even works on an ARCHOS 5 Android tablet. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
mscwd01 wrote: > Okay this is getting really rather annoying now. > > I have used both of the following methods of getting the screen > orientation and both do not work properly on different devices. > > Method 1: > Display display = ((WindowManager) getSystemService > (WINDOW_SERVICE)).getDefaultDisplay(); > int screenOrientation = display.getOrientation(); > > Method 2: > int screenOrientation = getResources().getConfiguration().orientation; > > Both methods work fine on the HTC Hero; however, they both fail on the > G1 and G2 devices (according to the users of my app). > > How can we be expected to make high quality applications if the API is > not supported on all devices??? > > I would be very greatful if someone could offer a solution to this, > its just not acceptable. I just tested this on a G1, and getResources().getConfiguration().orientation is 2 in landscape and 1 in portrait, just like it should be. I also tested it on an HTC Magic, and it works just fine. Heck, it even works on an ARCHOS 5 Android tablet. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
mscwd01 wrote: > Okay this is getting really rather annoying now. > > I have used both of the following methods of getting the screen > orientation and both do not work properly on different devices. > > Method 1: > Display display = ((WindowManager) getSystemService > (WINDOW_SERVICE)).getDefaultDisplay(); > int screenOrientation = display.getOrientation(); > > Method 2: > int screenOrientation = getResources().getConfiguration().orientation; > > Both methods work fine on the HTC Hero; however, they both fail on the > G1 and G2 devices (according to the users of my app). > > How can we be expected to make high quality applications if the API is > not supported on all devices??? > > I would be very greatful if someone could offer a solution to this, > its just not acceptable. I just tested this on a G1, and getResources().getConfiguration().orientation is 2 in landscape and 1 in portrait, just like it should be. I also tested it on an HTC Magic, and it works just fine. Heck, it even works on an ARCHOS 5 Android tablet. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Sorry I meant "works on the HTC Hero" NOT magic ;) On Oct 31, 6:11 pm, mscwd01 wrote: > Dianne, I have used the configuration to try and determine orientation > (see Method 2); however, this still fails on G1 and G2 devices. It > works on the HTC magic though. > > If you could offer some other solution i'd be very appreciative > indeed ;) > > On Oct 31, 6:00 pm, Dianne Hackborn wrote: > > > I'll make this a little stronger -- the Display object is LOW LEVEL access > > to the display. Trying to use this in an application is almost guaranteed > > to not do what you want. The current orientation should be retrieved from > > Configuration. The width and height should be retrieved from the view > > hierarchy. > > > I believe that Display.getOrientation actually returns the physical rotation > > applied to the display... I also notice that the documentation says nothing > > about what it actually returns, so how can you use it correctly? :) (The > > Display object clearly needs a lot more documentation... but this is a > > pretty low priority because, again, it really shouldn't be used by > > applications.) > > > On Sat, Oct 31, 2009 at 5:08 AM, Mark Murphy wrote: > > > > mscwd01 wrote: > > > > I added this to the activity tag in the manifest: > > > > android:screenOrientation="sensor" > > > > > Would that make any difference? > > > > That changes the trigger. For devices with a keyboard (e.g., G1), by > > > default, an orientation change is triggered by sliding the keyboard, not > > > the accelerometer. android:screenOrientation="sensor" forces it to be > > > the "sensor" (a.k.a., accelerometer) like the Magic, Hero, and other > > > keyboard-less devices. > > > > Since you are experiencing your problem with both the G1 (with keyboard) > > > and the Magic (sans keyboard), I doubt this will help, but I could > > > easily be wrong. > > > > -- > > > Mark Murphy (a Commons Guy) > > >http://commonsware.com|http://twitter.com/commonsguy > > > > Warescription: Three Android Books, Plus Updates, $35/Year > > > > -- > > > 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+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > Note: please don't send private questions to me, as I don't have time to > > provide private support, and so won't reply to such e-mails. 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Dianne, I have used the configuration to try and determine orientation (see Method 2); however, this still fails on G1 and G2 devices. It works on the HTC magic though. If you could offer some other solution i'd be very appreciative indeed ;) On Oct 31, 6:00 pm, Dianne Hackborn wrote: > I'll make this a little stronger -- the Display object is LOW LEVEL access > to the display. Trying to use this in an application is almost guaranteed > to not do what you want. The current orientation should be retrieved from > Configuration. The width and height should be retrieved from the view > hierarchy. > > I believe that Display.getOrientation actually returns the physical rotation > applied to the display... I also notice that the documentation says nothing > about what it actually returns, so how can you use it correctly? :) (The > Display object clearly needs a lot more documentation... but this is a > pretty low priority because, again, it really shouldn't be used by > applications.) > > On Sat, Oct 31, 2009 at 5:08 AM, Mark Murphy wrote: > > > > > mscwd01 wrote: > > > I added this to the activity tag in the manifest: > > > android:screenOrientation="sensor" > > > > Would that make any difference? > > > That changes the trigger. For devices with a keyboard (e.g., G1), by > > default, an orientation change is triggered by sliding the keyboard, not > > the accelerometer. android:screenOrientation="sensor" forces it to be > > the "sensor" (a.k.a., accelerometer) like the Magic, Hero, and other > > keyboard-less devices. > > > Since you are experiencing your problem with both the G1 (with keyboard) > > and the Magic (sans keyboard), I doubt this will help, but I could > > easily be wrong. > > > -- > > Mark Murphy (a Commons Guy) > >http://commonsware.com|http://twitter.com/commonsguy > > > Warescription: Three Android Books, Plus Updates, $35/Year > > > -- > > 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+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Okay this is getting really rather annoying now. I have used both of the following methods of getting the screen orientation and both do not work properly on different devices. Method 1: Display display = ((WindowManager) getSystemService (WINDOW_SERVICE)).getDefaultDisplay(); int screenOrientation = display.getOrientation(); Method 2: int screenOrientation = getResources().getConfiguration().orientation; Both methods work fine on the HTC Hero; however, they both fail on the G1 and G2 devices (according to the users of my app). How can we be expected to make high quality applications if the API is not supported on all devices??? I would be very greatful if someone could offer a solution to this, its just not acceptable. On Oct 31, 12:08 pm, Mark Murphy wrote: > mscwd01 wrote: > > I added this to the activity tag in the manifest: > > android:screenOrientation="sensor" > > > Would that make any difference? > > That changes the trigger. For devices with a keyboard (e.g., G1), by > default, an orientation change is triggered by sliding the keyboard, not > the accelerometer. android:screenOrientation="sensor" forces it to be > the "sensor" (a.k.a., accelerometer) like the Magic, Hero, and other > keyboard-less devices. > > Since you are experiencing your problem with both the G1 (with keyboard) > and the Magic (sans keyboard), I doubt this will help, but I could > easily be wrong. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, $35/Year -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
I'll make this a little stronger -- the Display object is LOW LEVEL access to the display. Trying to use this in an application is almost guaranteed to not do what you want. The current orientation should be retrieved from Configuration. The width and height should be retrieved from the view hierarchy. I believe that Display.getOrientation actually returns the physical rotation applied to the display... I also notice that the documentation says nothing about what it actually returns, so how can you use it correctly? :) (The Display object clearly needs a lot more documentation... but this is a pretty low priority because, again, it really shouldn't be used by applications.) On Sat, Oct 31, 2009 at 5:08 AM, Mark Murphy wrote: > mscwd01 wrote: > > I added this to the activity tag in the manifest: > > android:screenOrientation="sensor" > > > > Would that make any difference? > > That changes the trigger. For devices with a keyboard (e.g., G1), by > default, an orientation change is triggered by sliding the keyboard, not > the accelerometer. android:screenOrientation="sensor" forces it to be > the "sensor" (a.k.a., accelerometer) like the Magic, Hero, and other > keyboard-less devices. > > Since you are experiencing your problem with both the G1 (with keyboard) > and the Magic (sans keyboard), I doubt this will help, but I could > easily be wrong. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, $35/Year > > -- > 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+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
mscwd01 wrote: > I added this to the activity tag in the manifest: > android:screenOrientation="sensor" > > Would that make any difference? That changes the trigger. For devices with a keyboard (e.g., G1), by default, an orientation change is triggered by sliding the keyboard, not the accelerometer. android:screenOrientation="sensor" forces it to be the "sensor" (a.k.a., accelerometer) like the Magic, Hero, and other keyboard-less devices. Since you are experiencing your problem with both the G1 (with keyboard) and the Magic (sans keyboard), I doubt this will help, but I could easily be wrong. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices
Hi Mark, I added this to the activity tag in the manifest: android:screenOrientation="sensor" Would that make any difference? If I get "it still doesn't work" emails, i'll try your code. Thanks On Oct 31, 11:54 am, Mark Murphy wrote: > mscwd01 wrote: > > Hi, > > > I have had several complaints from people with G1 and MyTouch/G2 > > devices who say my application does not work correctly. The problem > > stems from the following code which gets the orientation of the phone: > > > // Get Screen Orientation > > Display display = ((WindowManager) getSystemService > > (WINDOW_SERVICE)).getDefaultDisplay(); > > int screenOrientation = display.getOrientation(); > > > I manually rotate the interface if the phone is in portrait > > (screenOrientation = 0) or landscape (screenOrientation = 1). > > > On my HTC Hero the code works fine and the correct orientation is > > determined, however on G1 and MyTouch devices it apparently never > > returns the correct orientation. As I do not have either of those > > phones to test this problem I am guessing they may return the opposite > > values to the HTC Hero? > > > Can anyone possibly explain this problem or let me know how to > > determine the screen orientation on ALL devices? > > You can try getConfiguration().orientation, which will be one of a > series of constants on the Configuration class. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _Beginning Android_ from Apress Now Available! -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en