When i set up the screen to "LANDSCAPE" mode, there was a problem.

Started by lasuicida, February 03, 2012, 10:06:39 AM

Previous topic - Next topic

lasuicida

I achieved the effect by taking "helloworld" as an example.
But when i set up the screen to mode "LANDSCAPE", the cube disappeared.
Anybody knows the reason please tell me why.
thanks a lot. ;D

EgonOlsen

Can you post the code that you are using for setting this in it's context?

lasuicida


@Override
public void onCreate(Bundle b) {
super.onCreate(b);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.camera_view);
initCamera();
initWorld();
}
private void initCamera() {
mSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mSurfaceHolder.addCallback(this);
}
        private void initWorld() {
if (master != null) {
copy(master);
}
mGLView = new GLSurfaceView(getApplication());
mGLView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);

renderer = new MyRenderer();
mGLView.setRenderer(renderer);

mGLView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
FrameLayout f = (FrameLayout) findViewById(R.id.camera_view_body);
f.addView(mGLView, 1);
}

Vi_O

try to set "landscape" from the AndroidManifest, It's cleaner and could even fix your problem.

here's the line :
android:screenOrientation="landscape"

Edit : put it in the activity proterty.

EgonOlsen

I'm doing it in code  all the time and it actually works fine. I think that this has something to do with the changes you made for supporting the camera or something. Does the HelloWorld-example survive a rotation of the device for you?

K24A3

The best way to force landscape is in the AndroidManifest file in this area:


    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
        <activity android:name=".MyActivity"
          android:screenOrientation="landscape"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>


This way will force landscape as soon as the app starts, and may speed up loading time.

Thomas.

maybe off topic, but do you know, how can I change lanscape mode (90 and 270 automatic switching)? I mean that it is posible from android 2.3...