Code example for Display

Methods: getSize

0
		WindowManager wm = getWindowManager(); 
		Display d = wm.getDefaultDisplay();
		 
		// the displays method to get size is deprecated, so use Point instead 
		Point size = new Point();
		d.getSize(size);
		int width = size.x;
		int height = size.y;
		 
		// width is greater then height which means landscape mode 
		if (width > height)
		{ 
			//---landscape mode---			             
			// android.R.id.content refers to the content  
			// view of the activity         
			fragmentTransaction.replace(
					android.R.id.content, landscape_fragment);
		} 
		else 
		{ 
			//---portrait mode---