I have a problem with the display of the layout when I rotate the screen from landscape to portrait o viceversa.
I've created a layout land (layout-sw720dp-land/example.xml ) and port (layout- sw720dp-port/example.xml ).
Until everything is right.
At the layout port, I've given the precise dimensions and the layout land other precise dimensions...
Previously I had a problem with the switch of the two layouts.
The transition from horizontal to vertical layout passed successfully, but the activity was destroyed and rebuilt.
I solved the problem by inserting in AndroidManifest.xml this code:
android:configChanges="orientation|screenSize"
Now the problem is that the transition from horizontal to vertical is not automatic. For example, I open the app horizontally and the app displays the correct layout (the layout-sw720dp-land / example.xml because I use a tablet) but once the app open and i turn the tablet vertically , the vertical layout is not displayed but remains in the horizontal version .. ( for example in the horizontal layout I have a button that its text is " Start " while in the vertical I have the same button that its text is " Finish " and when the app is open and i rotate the tablet from horizontal to vertical the the layout turn making me see , however, the horizontal version , so with the " start " button).
How can I do to show the correct layout WITHOUT re-create and destroy the activity ??
N.B : Using the fragment ... in short, I have a activity_main.xml file that references to activity "MainActivity.java" that inside it has this code:
<FrameLayout
        android:layout_below="@+id/toolbar"
        android:id="@+id/fragment_container"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:foreground="@drawable/shadow_toolbar"/>
inside of this FrameLayout I view the two layouts in this way :
FragmentExample fragment = new FragmentExample();
        android.support.v4.app.FragmentTransaction fragmentTransaction =
                getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.fragment_container, fragment);
        fragmentTransaction.commit();
In FragmentExample.java there are the two famous layout:
public class FragmentExample extends Fragment {
public FragmentExample() {
    // Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.example, container, false);
    // Inflate the layout for this fragment
    return rootView;
}
}
How can I do so to make the automatic switch of the two layout without closing and reopening the app and re-create it without ??
Sorry for my english =)
 
     
     
    