public int getStatusBarHeight() {
int result = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = getResources().getDimensionPixelSize(resourceId);
}
return result
}
this method worked fine for me.
[Reference]
http://stackoverflow.com/questions/3407256/height-of-status-bar-in-android
http://stackoverflow.com/questions/2485697/getting-the-size-of-the-window-without-title-notification-bars