Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes it is implementable!</p> <p><a href="http://developer.android.com/reference/android/content/pm/ActivityInfo.html#SCREEN_ORIENTATION_LANDSCAPE">ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE</a></p> <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); </code></pre> <p><a href="http://developer.android.com/reference/android/content/pm/ActivityInfo.html#SCREEN_ORIENTATION_PORTRAIT">ActivityInfo.SCREEN_ORIENTATION_PORTRAIT</a></p> <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); </code></pre> <p><strong>ActivityInfo</strong></p> <p><a href="http://developer.android.com/reference/android/content/pm/ActivityInfo.html">http://developer.android.com/reference/android/content/pm/ActivityInfo.html</a></p> <p>Refer the link:</p> <pre><code>Button buttonSetPortrait = (Button)findViewById(R.id.setPortrait); Button buttonSetLandscape = (Button)findViewById(R.id.setLandscape); buttonSetPortrait.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View arg0) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }); buttonSetLandscape.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View arg0) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } }); </code></pre> <p><a href="http://android-er.blogspot.in/2011/08/set-screen-orientation-programmatically.html">http://android-er.blogspot.in/2011/08/set-screen-orientation-programmatically.html</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload