0
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

WindowManager wm = getWindowManager();
Display d = wm.getDefaultDisplay();
if(d.getWidth()>d.getHeight()){

}

Why getWidth() not work? :(

The Original Android
  • 6,147
  • 3
  • 26
  • 31
Linh Tran
  • 21
  • 1

1 Answers1

2

getHeight() and getWidth() was deprecated in API level 13. Use getSize(Point) instead.

See http://developer.android.com/reference/android/view/Display.html#getHeight() and http://developer.android.com/reference/android/view/Display.html#getWidth()

try

WindowManager wm = getWindowManager();
Display d = wm.getDefaultDisplay();

Point point = new Point();
d.getSize(point);
if( d.x > d.y ) {
} 
Tamil Selvan C
  • 19,913
  • 12
  • 49
  • 70