Code example for Display

Methods: getOrientation

0
	} 
 
	public void stickOrientation() { 
		WindowManager mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
		Display mDisplay = mWindowManager.getDefaultDisplay();
		Log.d("ORIENTATION", "" + mDisplay.getOrientation());
		switch (mDisplay.getOrientation()) {
		case 0: 
			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			break; 
		case 1: 
			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			break; 
		} 
	} 
 
	public void onClick(View v) {
		try { 
			EditText et = (EditText) findViewById(R.id.defaultServerPortET);
			int i = Integer.parseInt(et.getText().toString());
Stop searching for code, let great code find you!  Add Codota to your java IDE