If you want to save state, Android has a built in construct, from
http://developer.android.com/intl/zh-TW/reference/android/app/Activity.html
"In addition, the method onSaveInstanceState(Bundle)  is called before
placing the activity in such a background state, allowing you to save
away any dynamic instance state in your activity into the given
Bundle, to be later received in onCreate(Bundle)"

Your activity will be destroyed and in the onCreate you can restore
the state based on the bundle that is passed in when the bundle is not
null. It is the easiest way imho. Don't bother with detecting
landscape vs portrait, if your app requires a different layout in
landscape, just create a separate layout for it and put it in the
right resource folder. (see here
http://developer.android.com/intl/zh-TW/guide/topics/resources/resources-i18n.html)

Hugo

On May 6, 7:48 am, ameya dandekar <[email protected]> wrote:
> Hi....
>   I am new to android....i m currently working on landscape mode for android
> app in which i want to know
>   how to maintain the state of the activity and views displayed on
> orientation change i.e from portrait mode to landscape mode ?
>
> Regards,
> Ameya
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to