First, I recommend you try to figure out the screen by getting the DisplayMetrics instead. Don't use the orientation/rotation. The device implementer gets to decide what the rotation means, so the screen rotation is fundamentally divorced from the concept of "landscape" or "portrait" (yep, I've seen system builds for Chinese tablets where Surface.ROTATION_0 is "portrait" mode on one but "landscape" mode on another).
Second, for supporting different APIs, consider building a separate app/apk for later APIs. Android Market now supports this (see http://developer.android.com/guide/market/publishing/multiple-apks.html). You're going to have to live with the fact that older APIs simply become obsolete. Building on a single base API will be easier to the code clean. Third, as for your frustration, you've run smack into the "fragmentation" problem. (oo, can I win some geek fame and coin a phrase: "Congratulations Greg, you've been 'and-fragged'" :-P ). Seriously, my advice is to bear the pain, hope it goes away, and move toward support of only the latest APIs. A year and a half ago, I made an app that works on contacts under 1.5 (API 3) because most Android phones were still running 1.5/1.6. Later, when upgraded it to the later APIs, I decided to keep backward compatibility (not a straightforward task since the original Contacts class was completely deprecated for ContactsContract). Now, 1.6 and earlier devices make up less than 4% of devices using Android Market, so pre-2.0 support seems moot, and the API moves are accelerating. API 10 came out in Feb. and is already supported by almost a quarter of devices. By the end of the year, chances are the majority of devices will be on API 10 or above, so you might as well get familiar with them. On Aug 22, 10:40 am, Greg Donald <[email protected]> wrote: > On Sun, Aug 21, 2011 at 7:48 PM, Dianne Hackborn <[email protected]> wrote: > > Because we are sometimes dumb. That is why it is deprecated and replaced > > with a method named getRotation() in current versions of the platform. > > > A nice person spent a long time harassing me about this change because they > > insistent that we were evil vile losers who didn't understand what app > > developers needed by deprecating the getOrientation() method. I never > > figured out exactly what was motivating all of that. But if that person is > > reading: this is why. :) > > From where I sit Android is becoming really hard to keep up with. I > have a ton of 2.1 users still so I need to stay with API version 7. > The current API is 13, that's almost double the version I need to stay > at. I can't force people to upgrade or buy a new phone. Meanwhile > the SDK docs show more and more "non documentation" for API version 7 > every day due the continuing deprecation. > > What's a developer to do? > > -- > Greg Donald -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] 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

