ref. Android Application Development Tutorial - 59 - Altered Landscape Layout ( https://www.youtube.com/watch?v=fV3cpnNPWo0&index=59&list=PL2F07DBCDCC01493A )

So as to save the data when the orientation changes, i did this :
saved it in onSaveInstanceState(Bundle outState)  and retrieved it in onRestoreInstanceState(Bundle savedInstanceState).
now, as shown in the video, for the landscape view, i changed the design a bit by bringing the buttons next to each other.. exactly as shown in that video..(in Portrait mode, the buttons are  one below the other)

So now,  what i have is, i am able to save the change happening in the TextView,, when the orientation changes.. but the new layout design i created for landscape mode is not being picked.. i.e. the button
is still one below other as in portrait mode. how do i handle that ?
i read about onConfigurationChanged(Configuration newConfig), but i didn't exactly understand how to go about it.
Can anyone suggest anything on this. I'd be grateful. thanks.

MainActivity.java :
package com.example.apptest;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {

    private int sum = 0;
    Button add, sub;
    TextView tv1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv1 = (TextView) findViewById(R.id.textView1);

        add = (Button) findViewById(R.id.button1);
        add.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                sum++;
                tv1.setText("Incrementation = " + sum);
            }
        });
        sub = (Button) findViewById(R.id.button2);
        sub.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                sum--;
                tv1.setText("Decrementation = " + sum);
            }
        });
    }

    
@Override
public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
super.onConfigurationChanged(newConfig);

if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
// setContentView(R.layout.activity_main);
Log.v("message", "ORIENTATION_LANDSCAPE");

} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
Log.v("message", "ORIENTATION_PORTRAIT");
}

}



    @Override
    protected void onSaveInstanceState(Bundle outState) {
        // TODO Auto-generated method stub
        super.onSaveInstanceState(outState);
        outState.putInt("sum", sum);
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onRestoreInstanceState(savedInstanceState);
        int x = savedInstanceState.getInt("sum");
    }

}


res\layout-land\activity_main.xml



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="@drawable/backg"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="total is = 0"
        android:layout_gravity="center"
        android:textSize="40sp"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >
    
    <Button
        android:id="@+id/button1"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:text="ADD" />

    <Button
        android:id="@+id/button2"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_gravity="center"
        android:text="Sub" />
    </LinearLayout>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Large Text"
        android:textAppearance="?android:attr/textAppearanceLarge" />
   
</LinearLayout>


res\layout\activity_main.xml :



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="@drawable/backg"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:freezesText="true"
        android:text="total is = 0"
        android:textSize="40sp"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/button1"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="ADD" />

    <Button
        android:id="@+id/button2"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Sub" />
   
</LinearLayout>


in manifest i added that : android:configChanges="orientation|screenSize"
(so how do i use onConfigurationChanged() in java ? )



<activity
            android:name="com.example.apptest.MainActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.example.apptest.MAINACTIVITY" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>


Thanks ! :)