Fragments

Hi,

This is my Second Page. Will Come with a good example soon. :)

Creating Fragment in XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"

    >

     <fragment class="com.ni.sample.fragments.TitlesFragment"
            android:id="@+id/frag_title"
            android:visibility="gone"
            android:layout_width="300px"
            android:layout_height="400px" />

    <fragment class="com.ni.sample.fragments.ContentFragment"
            android:id="@+id/frag_content"
            android:layout_width="500px"
            android:layout_height="400px" />

     <fragment class="com.ni.sample.fragments.Fragment1"
            android:id="@+id/frag_content_one"
            android:layout_width="340px"
            android:layout_height="400px" />
</LinearLayout>

Fragments in Java without using "fragment" tag in XML:

Fragment fm = new MySampleFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction(); 
transaction.add(R.id.parentlayout,fm).commit();    //parentlayout is the layout to which we want to add fragment.