java - Rotate surfaceview according to display orientation -


i facing problem while writing camera application. layout this.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/mainlayout" >  <surfaceview      android:id="@+id/surface"     android:layout_width="240px"     android:layout_height="160px" />  <!--  horizontal blue line -->  <view     android:layout_width="match_parent"     android:layout_height="1px"     android:background="@color/blue"/>  <linearlayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="horizontal" >      <scrollview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:scrollbaralwaysdrawverticaltrack="true" >          <textview             android:id="@+id/details1"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textcolor="@color/blue"             android:textsize="12sp" />     </scrollview>      <!-- vertical blue line -->     <view     android:layout_width="1px"     android:layout_height="match_parent"     android:background="@color/blue"/>      <textview             android:id="@+id/details2"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textcolor="@color/blue"             android:textsize="12sp"              android:text="@string/about"/> </linearlayout> 

to stop system restarting activity, have included attribute activity tag in manifest.

android:configchanges="keyboardhidden|orientation|screensize|keyboard|layoutdirection" 

the surfaceview showing camera preview. have handle orientation change without calling methods on camera object ,i.e., surface view should show correct orientation of camera preview without invoking camera.setdisplayorientation().

i tried rotate surfaceview in onconfigurationchanged(), surfaceview not show preview when rotated, shows preview in original orientation.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -