1

Let's say that onCreate looks like this

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    initializeElements();
    setOnClickListeners();

    updateTable();
}

Does onConfigurationChanged:

  • has to look the same (see below),
  • I do not have to use any of onCreate methods or
  • I have omitted something?

Here's the other method.

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    setContentView(R.layout.main);  

    initializeElements();
    setOnClickListeners(); 

    updateTable();

}
sandalone
  • 41,141
  • 63
  • 222
  • 338

1 Answers1

1

If the onConfigurationChanged is the same as onCreate, you shouldn't need to have an onConfigurationChanged because android will call onCreate.

OnconfigurationChanged is normally used when you don't want android to restart your app, so you usually just recreate the view and continue running your program.

Marcio Covre
  • 4,556
  • 2
  • 22
  • 24
  • Does it mean it will be empty? If not, what should I do there? – sandalone Feb 11 '12 at 16:28
  • Delete the onConfigurationChanged method and also remove the configuration changes on the Manifest, this way android will restart your application and onCreate will be called instead of onConfigurationChanged – Marcio Covre Feb 13 '12 at 10:26