I am trying to create a method that returns me a serialization-dependent dependency on if the device is portable or tablet.
public int getScreenOrientation(boolean isTablet){ if(isTablet){ return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else { return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } }
But when I use setRequestedOrientation(getScreenOrientation)); , I get lint-error Must be one of: ActivityInfo.SCREEN_ORIENTATION_......... which I can suppress, but it does not look like clean code.
So, I found that getRequestedOrientation uses the @ActivityInfo.ScreenOrientation annotation. So I tried using it myself:
@ActivityInfo.ScreenOrientation public int getScreenOrientation(boolean isTablet){ . . . }
But the IDE gives me a message stating that Annotation @ActivityInfo.ScreenOrientation could not be found. But it is declared public in the official android source.
java android annotations
Altoyyr
source share