Camera auto rotate problem

All your problems with Audio, Video and Images.

Camera auto rotate problem

Postby aarontwc » Tue Jul 13, 2010 6:58 am

I am trying to implement by own camera.. the codes are largely base on the following tutorial:
http://snippets.dzone.com/posts/show/8685

However, the preview is always shown rotated (90 degrees to the left).. when i rotate the camera, the preview rotates too. In other words, the object i am taking a picture off always appears to be rotated on the preview page. Does anyone have any idea what is going on? I tried using Android's camera function and the preview was appearing correctly. So it should not be a camera issue.. but i can't find anything wrong with the code.

my XML is also pretty simple:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background">
<SurfaceView android:id="@+id/SurfaceCamera" android:layout_gravity="center_horizontal|top" android:layout_marginTop="20px" android:layout_width="420px" android:layout_height="560px" android:onClick="takePicture" />
<ImageView android:id="@+id/ImageView07" android:layout_gravity="bottom" android:layout_marginLeft="30px" android:layout_marginBottom="130px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/btngoback" android:onClick="loadDetail"></ImageView>
<ImageView android:id="@+id/ImageView08" android:layout_gravity="bottom|right" android:layout_marginRight="30px" android:layout_marginBottom="130px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/btncamera" android:onClick="takePicture"></ImageView>
</FrameLayout>


Aaron
aarontwc
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jul 13, 2010 6:45 am

Top

Re: Camera auto rotate problem

Postby blundell » Wed Jul 14, 2010 2:10 pm

Haven't got the reason but might have a solution.

Set your framelayout to android:orientation="horizontal" hehe, aint a pretty one!
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: TurnitinBot [Bot] and 16 guests