2

I have my own implementation of Dialog

public class MyDialog extends Dialog

Is it possible to respond to orientation change from within the MyDialog class and change layout used by the dialog if Activity that creates it has the following in the manifest:

android:configChanges="keyboard|keyboardHidden|orientation"

Thanks

Asahi
  • 13,378
  • 12
  • 67
  • 87

2 Answers2

2

The android:configChanges="orientation" flag just indicates that the Activity class will perform the orientation adjustments on it's own and that the Activity should not be destroyed/recreated (onCreate will not be called again) when orientation changes. You can find a good explanation on how to handle this @ How to make an application ignore screen orientation change?

Also in my point of view we should try and avoid setting this flag as it's not considered as a best practice. A more appropriate way to handle Activity recreates upon orientation changes is explained in detail @ http://blog.doityourselfandroid.com/2010/11/14/handling-progress-dialogs-and-screen-orientation-changes/ in detail.

Community
  • 1
  • 1
arcamax
  • 610
  • 1
  • 7
  • 14
0

The way you have declared it in your manifest, you say you will handle orientation changes yourself. Your activity won't get restartet, but onConfigurationChanged() will be called. You should do the necessary adjustments there.

You probably have to dismiss the dialog and re-show it within onConfigurationChanged().

icyerasor
  • 4,973
  • 1
  • 43
  • 52
  • 1
    that means that the change is to be made in [every] activity that invokes the dialog. I very much would like to avoid that. – Asahi Mar 08 '11 at 15:29