• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps call order of surfaceChanged() and onConfigurationChanged()

BananoTron

Member
hey folks,

i just realized that android (or at least the emulator) does not always call the surfaceChanged() and onConfigurationChanged() methods in the same order when the user rotates the device.
most of the time onConfigurationChanged() is called first on the Activity and then surfaceChanged() is called on the view. but sometimes it's the other way round.

what do you guys think about that? shouldn't there be a defined order of calls to these callbacks? i mean when you don't know what's called first, it can be tricky for your app to do the correct thing. ie. in my game i re-position all the ui components and scale the background image when the user rotates the device. without knowing in one callback method if the other callback method was called already, i cannot rely on the information i have. my solution was to ignore the onConfigurationChange method and simply decide based on the screen dimensions if i'm in portrait or landscape mode. but this is a hack.
 
Back
Top Bottom