restore Orientation - Android android.app

Android examples for android.app:Screen

Description

restore Orientation

Demo Code

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.view.Surface;

public class Main{

    public static void restoreOrientation(Activity activity, int orientation) {
        if (activity != null) {
            activity.setRequestedOrientation(orientation);
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
        }/*from   w  ww . j  a v a 2s. co m*/
    }

}

Related Tutorials