Activity setRequestedOrientation - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Activity setRequestedOrientation method.

This code example shows how to use the following methods:getRequestedOrientation, getWindow, setRequestedOrientation
        if (mCustomView != null) {
            callback.onCustomViewHidden();
            return; 
        } 
 
        mOriginalOrientation = mActivity.getRequestedOrientation();
        FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
        mFullscreenContainer = new FullscreenHolder(mActivity);
        mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
        decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
        mCustomView = view;
        setFullscreen(true); 
        ((BrowserWebView) getWebView()).setVisibility(View.INVISIBLE);
        mCustomViewCallback = callback;
        mActivity.setRequestedOrientation(requestedOrientation);
    } 
 
    @Override 
    public void onHideCustomView() { 
        ((BrowserWebView) getWebView()).setVisibility(View.VISIBLE);

6
CodeRank
This code example shows how to use the following methods:setRequestedOrientation
package com.harasoft.relaunch; 
 
import android.app.Activity; 
import android.content.SharedPreferences; 
import android.content.pm.ActivityInfo; 
 
public class ScreenOrientation { 
	public static void set(Activity act, SharedPreferences prefs) {
		if (prefs.getString("screenOrientation", "NO").equals("PORTRAIT")) {
			act.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		} 
		if (prefs.getString("screenOrientation", "NO").equals("LANDSCAPE")) {
			act.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		} 
	} 
} 

6
CodeRank
This code example shows how to use the following methods:setRequestedOrientation
	 */ 
 
	public void setActivityOrientation(int orientation)
	{ 
		Activity activity = getCurrentActivity();
		activity.setRequestedOrientation(orientation);	
	} 
 
	/** 
	 * Returns the current {@code Activity}, after sleeping a default pause length. 
	 * 
	 * @param shouldSleepFirst whether to sleep a default pause first 
	 * @return the current {@code Activity} 
	 */ 
 
	public Activity getCurrentActivity(boolean shouldSleepFirst) {
		return getCurrentActivity(shouldSleepFirst, true);
	} 
 
	/** 
6
CodeRank
This code example shows how to use the following methods:setRequestedOrientation
This code example shows how to use the following methods:setRequestedOrientation
			} 
		} 
 
		if (e != null) {
			e.printStackTrace();
			Dialog dialog = new Dialog(context, e);
			dialog.show();
		} 
		UnlockScreenRotation(); 
	} 
 
	private void loadTrailReports() throws Exception { 
 
		try { 
			listCreator.getTrailReports(trailReports, trailInfos, factory
					.getUserSettings().getForcedRefresh(), progressBar);
		} catch (Exception e) {
			e.printStackTrace();
			trailReports.clear();
			throw e;

4
CodeRank

Related Activity setRequestedOrientation Questions & Answers:

Other Activity setRequestedOrientation Examples

79:			super.onCreate(savedInstanceState);
80:			setContentView(R.layout.activity_main);
81:			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
82:			
83:			cd = new ConnectionDetector(getApplicationContext());

Read More

setRequestedOrientation Method Overview
Change the desired orientation of this activity.
See Code Examples for other Android Activity Methods: