Reputation: 21
I have a problem and it is really doing my head in. All I want to do is a very simple task, determine the rotation of the screen. Now Display.getRotation() does exactly this.
http://developer.android.com/reference/android/view/Display.html#getRotation%28%29
However when I try to use it I just get "The method getRotation() is undefined for the type Display" and Eclipse tells me to change it to the deprecated function getOrientation() which will not work for what I need because it only returns Landscape/Portrait, not 0/90/180/270.
Does anyone have an idea why this might not be working?
Upvotes: 2
Views: 6317
Reputation: 10063
Use getOrientation() instead. The two functions seem to be identical; I have no idea why they deprecated getOrientation in 2.2.
Upvotes: 0
Reputation: 8942
Display.getRotation() is only available as of API8 (Froyo / 2.2). Your app project probably specifies an earlier API level.
public int getRotation () Since: API Level 8
Upvotes: 4