I am trying to use the fragments but not able to use it.

This is the code for my main activity

```
public class StartingActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragmentexample);}}

```

here is the fragmentexample.xml

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<fragment 
    android:name="com.example.demos.Fragment1"
    android:id="@+id/idfragment1"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    />

<fragment 
    android:name="com.example.demos.Fragment2"
    android:id="@+id/idfragment2"
    android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    />

```

here is the class Fragment1

```
 public class Fragment1 extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    return inflater.inflate(R.layout.fragment1, container, false);
}

```

}

and here is fragment1.xml

```
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="This is Fragment1" />

</LinearLayout>

```

class Fragment2 and fragment2.xml are just same as Fragment1 and fragment1.xml

but this code is not working and giving the error

```
03-06 13:43:50.011: E/AndroidRuntime(26696): FATAL EXCEPTION: main
03-06 13:43:50.011: E/AndroidRuntime(26696): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demos/com.example.demos.StartingActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-06 13:43:50.011: E/AndroidRuntime(26696):    ... 11 more

```