How to change layout after orientation changed (without reloading app)
<p>I have a problem with the display of the layout when I rotate the screen from landscape to portrait o viceversa.</p>

<p>I've created a layout land (layout-sw720dp-land/example.xml ) and port (layout- sw720dp-port/example.xml ).</p>

<p>Until everything is right.</p>

<p>At the layout port, I've given the precise dimensions and the layout land other precise dimensions...</p>

<p>Previously I had a problem with the switch of the two layouts.</p>

<p>The transition from horizontal to vertical layout passed successfully, but the activity was destroyed and rebuilt.</p>

<p>I solved the problem by inserting in AndroidManifest.xml this code:</p>

<pre><code>android:configChanges="orientation|screenSize"
</code></pre>

<p>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).</p>

<p>How can I do to show the correct layout WITHOUT re-create and destroy the activity ??</p>

<p>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:</p>

<pre><code>&lt;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"/&gt;
</code></pre>

<p>inside of this FrameLayout I view the two layouts in this way :</p>

<pre><code>FragmentExample fragment = new FragmentExample();
        android.support.v4.app.FragmentTransaction fragmentTransaction =
                getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.fragment_container, fragment);
        fragmentTransaction.commit();
</code></pre>

<p>In FragmentExample.java there are the two famous layout:</p>

<pre><code>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;
}
</code></pre>

<p>}</p>

<p>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 ??</p>

<p>Sorry for my english =) </p>