2

I encountered weird problem when changing screen orientation rather fast, or when something heavy goes on background. When I call setContentView(R.layout.main);on onConfigurationChanged (I handle orientation changes myself),after screen is rotated android for a brief moment sets layout for opposite to orientation. For example - when you change orientation layout changes like this Portrait>Landscape, but sometimes, in my case, it goes like this Portrait>Portrait(when phone is already in in landscape position)>Landscape.

Sometimes you dont even notice this, and sometimes screen shrinks to about 1/3 for a second. Well, It's not really a big deal, but in my activity I have Coverflow widget (based on Gallery) and to make it look good on most of the screens I set image sizes based on parent container size (in onSizeChanged of widget), and when orientation changes goes as described above coverflow widget picks up a wrong size.

The only way I see now is to either call onCreate on orientation change (Which I cant do, because of heavy UI populated online), or set a delay on initializing UI (which is ugly).

So I wonder, is there any callback of setContentView() or anything else, so I could know when layout is actually ready, so I can init UI.

Or maybe there is another way around?

PS: For some reason this glitch mostly occurs on Desire HD.

Sver
  • 3,349
  • 6
  • 32
  • 53
  • 1
    I think I'm seeing the same thing here illustrated by this simple test app: [Why does onLayout and onSizeChanged get called twice on an orientation change?](http://stackoverflow.com/q/9696118/369658) – MikeV Mar 14 '12 at 18:42

1 Answers1

0

AndroidManifest.xml

android:configChanges="orientation"

Is it what you expect?

Pete Houston
  • 14,931
  • 6
  • 47
  • 60