Re: [android-developers] Activity.setIntent() is a noop if activity is recreated
Maybe a documentation bug, but this is just how Android is designed:
most developers know this (or quickly learn it when their app crashes
after they turn their screen :-).
Kris
On Thu, Aug 1, 2013 at 2:52 PM, Shri <shri.borde@gmail.com> wrote:
> Using setIntent() is dangerous in the face of activity recreations (which
> can be more easily triggerred with "Developer settings | Don't keep
> activities"). Normally getIntent() returns the intent set by setIntent().
> However, this gets reset after the activity is recreated. This is in line
> with the trivial implementation of setIntent() in
> https://github.com/android/platform_frameworks_base/blob/master/core/java/android/app/Activity.java
>
> public void setIntent(Intent newIntent) {
> mIntent = newIntent;
> }
>
> This seems like a "bug" in setIntent in the sense that it misleads people
> into thinking that it can be used to cache state without realizing the
> activity recreate problem. Am I missing anything?
>
> Thanks,
> Shri
>
> --
> --
> 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+unsubscribe@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 unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
--
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+unsubscribe@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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home