My recommendation, before heading down that path, is to look up Romain Guy's
blog post on fast orientation changes. It covers another orientation change
optimization with which you can let Android recreate your activity, and
still have good response time.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com
15.02.2011 1:24 пользователь "Kevin Duffey" <andjar...@gmail.com> написал:
> Oh.. so if you implement that onConfigurationChage, then orientation
changes
> (among other things) don't stop/restart activities? I'll have to read
about
> that. You'd think that would be emphasized more.. or is there some reason
it
> is not done as often?
>
> On Mon, Feb 14, 2011 at 12:37 PM, Kostya Vasilyev <kmans...@gmail.com
>wrote:
>
>> 14.02.2011 23:13, Kevin Duffey пишет:
>>
>> Incidentally, I don't know if there are other reasons for restarting
>>> activities on orientation changes, but I know one reason it's done is to
>>> allow potential layout changes to occur. You can provide layouts for
both
>>> landscape and portrait. I don't know why some sort of event handler
couldn't
>>> be called without restarting the entire activity...
>>>
>>
>> There is just such handler - onConfigurationChanged:
>>
>>
>>
http://developer.android.com/reference/android/app/Activity.html#onConfigurationChanged(android.content.res.Configuration)
>>
>> ... but you have to tell Android that your code is able to handle it:
>>
>>
>>
http://developer.android.com/guide/topics/manifest/activity-element.html#config
>>
>> Note that there are more potential config change cases than just the
>> orientation change - in particular, the user may change the phone's
locale
>> setting - other cases are listed on the page above.
>>
>> The automatic destroy / recreate cycle is there as a catch-all, with the
>> onConfigurationChanged providing a possibility for an optimization.
>>
>> --
>> Kostya Vasilyev -- http://kmansoft.wordpress.com
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to