0
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (savedInstanceState != null) {
        return;
    }
    // processing
}

Is it a good practice to avoid processing further if the savedInstanceState is not null? does this have any drawback?

Kaidul
  • 15,409
  • 15
  • 81
  • 150

1 Answers1

0

I expect this code is not what you want as there can be different times you want to have savedInstanceState so if it is set pull out the data you will have saved so the user has the same state though they may have rotated their phone.

You may want to look at this question and answers

What's onCreate(Bundle savedInstanceState)

Community
  • 1
  • 1
James Black
  • 41,583
  • 10
  • 86
  • 166