i'm using the getrotation function to detect the initial rotation of a screen when my activity is created. But when i used to logged out what returns this function, i mentioned that on my P1000, when rotation = 1 or 3, this means my tablet is in landscape. But on my 10.1 tab, when rotation = 0 or 2, this means my tablet is in landscape. This is causing me a problem in the background image usage replacement. This is my code :
HomeBackground = (ImageView) findViewById(R.id.home_background);
Display display = ((WindowManager) this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int rotation = display.getRotation();
if (rotation == 1 || rotation == 3) {
HomeBackground.setBackgroundResource(R.drawable.home_bg_landscape);
} else {
HomeBackground.setBackgroundResource(R.drawable.home_bg_portrait);
}
So whats the solution to detect the initial rotation of a screen using another method? or what is my bug? Thank you.