Do you use same methods in onConfigurationChanged as in onCreate?
Question
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();
}
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow