tags:

views:

11

answers:

1

I have a ViewGroup that gets inflated dynamically. I have set Id's to all the inflated views. I am still not able to retain the inflated ViewGroup whenever the orientation is changed.

Any particular check that i am missing here ?

A: 

You can check in this condition

@Override
public void onConfigurationChanged(Configuration newConfig) {

    super.onConfigurationChanged(newConfig);

    if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
             //your code

    } else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
             //your code
    }
}
krunal shah