I am new to android. I created a main.xml file like
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:paddingTop="5dp"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:src="@drawable/mazarslogo" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_launcher" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" >
....
</RelativeLayout>
</LinearLayout>
This file is in my res/layout/main.xml folder. Now i create a new folder named layout-land and put a file main.xml in it. i.e. res/layout-land/main.xml, and put the following code in it
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:src="@drawable/mazarslogo" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_launcher" />
</LinearLayout>
here is my class
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//---the two buttons are wired to the same event handler---
Button btn_login = (Button)findViewById(R.id.btn_login );
btn_login.setOnClickListener(btnListener);
.....
} //end of onCreate()
} //end of class MainActivity
But now when i run the project, the project open in portrait mode, but when i press ctrl+F11 to change the orientation of the emulator then i get error.
Here is the portrait mode pic

Why i am getting this error in landscape mode? What i am doing wrong?
Thanks
Edit
——————————————————————-
Here is my working res/layout-land/main.xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:padding="1dip"
android:orientation="horizontal" > >
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center"
android:paddingLeft="20dip"
android:paddingRight="20dip" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:src="@drawable/mazarslogo" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:src="@drawable/ic_launcher" />
<TableLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:stretchColumns="*" >
<TableRow>
<Button
android:id="@+id/btn_login"
android:text="@string/login"
android:textSize="12sp"
android:textStyle="bold" />
<Button
android:id="@+id/btn_aboutUs"
android:text="@string/aboutUs"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
<TableRow>
<Button
android:id="@+id/btn_contactUs"
android:text="@string/contactUs"
android:textSize="12sp"
android:textStyle="bold" />
<Button
android:id="@+id/btn_exit"
android:text="@string/exit"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</LinearLayout>
First thing keep in mind both xml should be with same data either imageview ,button,or layout there id should also be same for both layout for potrait and lancaspe layout and u have need to add following thing in menifest in activtiy