adjust Camera Orientation - Android Camera

Android examples for Camera:Camera Orientation

Description

adjust Camera Orientation

Demo Code


//package com.java2s;
import android.content.Context;

import android.content.res.Configuration;

import android.hardware.Camera;

public class Main {
    public static void adjustCamera(Context context, Camera camera) {
        if (context.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
            //parameters.set("orientation","portrait");
            camera.setDisplayOrientation(90);
        } else {//from w w  w .java  2  s  .  c o m
            //parameters.set("orientation","landscape");
            camera.setDisplayOrientation(0);
        }
    }
}

Related Tutorials