I think I misunderstood when onRestoreInstanceState is called so ignore that part. But the problem still remains, the bundle is always null even though it is saved. I have logging showing me onSaveInstanceState is called.
On Sep 20, 12:11 pm, GregAZ <ggur...@gmail.com> wrote: > savedInstanceState is always null. For some reason this just started > happening. onSaveInstanceState is being called but here's what's > happening: > > 1. Launch app by pressing app icon > 2. Hit home button (I've verified onSaveInstanceState is called) > 3. Launch app by pressing app icon > 4. Attempt to read savedInstanceState in onCreate but it's null > > Example of my onSaveInstanceState: > > protected void onSaveInstanceState(Bundle outState) { > // TODO Auto-generated method stub > outState.putString("uploadUrl", uploadUrl); > super.onSaveInstanceState(outState); > } > > What would cause this to be null? > > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > > if (savedInstanceState != null) // always null > { > uploadUrl = savedInstanceState.getString("uploadUrl"); > > } > } > > I just added the following override and it's never called (I have > logging in it): > @Override > protected void onRestoreInstanceState(Bundle savedInstanceState) { > > } > > I'm just storing short term values so I don't want to use > preferences. The problem is if a new activity opens those values are > lost and I need them when the user goes back to the original > activity. This was working. -- 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