Can anybody tell me how to retain the state of inflated开发者_高级运维 layout while configuration changes, in android? Can anybody provide some sample code?
Thanks
It's not cleat which part you have problem with. But anyway, take a good read of:
- Activity Lifecycle: Saving Activity state
- Handling Runtime [Configuration] Changes
Also, all views with assigned id's usually save their state themself.
Activity.onSaveInstanceState - save current state
Activity.onRestoreInstanceState - restore from saved state
More reading: http://developer.android.com/reference/android/app/Activity.html#SavingPersistentState
This is one trick I've learned to retain the current layout when configuration changes: http://xjaphx.wordpress.com/2011/09/19/the-less-known-over-screen-orientation/
精彩评论