Dmitry Zaytsev
Dmitry Zaytsev

Reputation: 23962

Save instance state - how it's works?

In Activity we have method

@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    //...
}

My questions is:

1) If I didn't override onSaveInstaceState, can savedInstanceState be not null?

2) If it can, is there a way to check existance of some savedInstanceState field better than

if(savedInstanceState.getString("SomeField")!=null){...}

3) How to handle onSaveInstanceState method in debugger? I testing my app on real device, that have a lot of memory (Asus TF101), so it's a problem to "overflow" it each time.

Upvotes: 0

Views: 739

Answers (1)

Olegas
Olegas

Reputation: 10517

  1. No, it can't. See http://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)
  2. Use Bundle.containsKey
  3. To "overflow"? What is the reason to do this?

Upvotes: 1

Related Questions