In my Activity some external thing (service) need to be destroyed in onDestroy(). But I do not want this when configuration change happens (e.g. keyboard flips out) because it w
This may do the trick for you (from How to distinguish between orientation change and leaving application android):
Use the Activity's isFinishing() method.
Sample code:
@Override
protected void onDestroy() {
super.onDestroy();
if (isFinishing()) {
// Do stuff
} else {
// It's an orientation change.
}
}