In the Android Activity lifecycle, when Activity.onCreate() is called after resuming (IE. not when activity created initially or in response to screen rotation) would this code return a valid (non-null) Bundle?
public void onCreate(Bundle savedInstanceState) {
Bundle b = this.getIntent().getExtras();
// is b == null? (when activity is resumed)
}
I am trying to reproduce a problem that occurs when the application has not been used for a long period - when the user returns, the application crashes.
okay, so when Android kills my app and the user navigates back - onCreate() is fired with a >new< Activity, and the original Intent along with it's associated Extras is gone; or do the Extras get attached to the new Intent by Android?
I was wondering the same thing and tested this quickly in my application.
It turns out intent extras are available when an activity is re-created after your application got killed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With