I have a little problem to detect when the application is finished. I need to do some actions onDestroy like save the parameters into the database and make a final connection to the server.
The problem is that if I put the code in onDestroy
its is called when the orientation changes for example. Putting
android:configChanges="orientation|keyboardHidden"
in the manifest for that activity the landscape/portrait layouts don't swap. And adding
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.main);
}
Changes the layouts but the buttons and labels do not get the onClickListeners
and the text labels correctly. How can I solve that? Thanks