0
我有一個活動,可以將活動設置爲lanscape,但是如果活動啓動時手機處於肖像模式,則出現此錯誤,活動停止並返回到其他活動活動:導致崩潰的方向錯誤
05-30 11:06:48.335: D/DOMX(125): ERROR: failed check:(eError == OMX_ErrorNone) || (eError == OMX_ErrorNoMore) - returning error: 0x80001005 - Error returned from OMX API in ducati
05-30 11:06:48.335: E/CameraHAL(125): Error while configuring rotation 0x80001005
05-30 11:06:48.460: D/DOMX(125): ERROR: failed check:(eError == OMX_ErrorNone) || (eError == OMX_ErrorNoMore) - returning error: 0x80001005 - Error returned from OMX API in ducati
05-30 11:06:48.460: E/CameraHAL(125): Error while configuring rotation 0x80001005
05-30 11:06:48.765: E/CameraHAL(125): Adapter state switch PREVIEW_ACTIVE Invalid Op! event = 0xf
的活動正在從也被設置爲橫向另一個活動調用,如果切換,同時保持設備在景觀..從持有肖像的設備,只有當活動它不會崩潰發射的時間..
在這兩個活動中我設置在onCreate()像這樣的方向:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
這似乎也與事實,我按一個CameraPreview表面被推出,所以我包括相機類櫃面的活動做的問題是:
public class KNCamLayer extends SurfaceView {
Camera camera;
SurfaceHolder previewHolder;
public KNCamLayer(Context context)
{
super(context);
previewHolder = this.getHolder();
//previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
previewHolder.addCallback(surfaceHolderListener);
}
SurfaceHolder.Callback surfaceHolderListener = new SurfaceHolder.Callback() {
public void surfaceCreated(SurfaceHolder holder) {
camera=Camera.open();
try {
camera.setPreviewDisplay(previewHolder);
}
catch (Throwable e){ }
}
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
Parameters params = camera.getParameters();
//params.setPreviewSize(width, height);
params.setPictureFormat(PixelFormat.JPEG);
camera.setParameters(params);
camera.startPreview();
}
public void surfaceDestroyed(SurfaceHolder arg0)
{
camera.stopPreview();
camera.release();
}
};
public void onResume() {
camera.startPreview();
}
public void onPause() {
// TODO Auto-generated method stub
camera.stopPreview();
}
}
的CameraView在活動的的onResume()添加像這樣:
camPreview = new KNCamLayer(this);
frame.addView(camPreview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
it'e因爲這個屬性力量相機的活動是在景觀,並沒有給選項設備本身來決定哪些查看了它要執行取向時沒有定義的 – Saqib