I want to create a list in fragment (some thing like left navigation). But not able to populate the list in fragment
<p>I want to create a list in fragment (some thing like left navigation). For this I used following code but not able to populate the list in fragment.</p>

<p>Main.xml:</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" &gt;

    &lt;fragment android:id="@+id/categoryList"
              android:layout_height="fill_parent"
              android:name="com.example.fragments.CategoryListFragment"
              android:layout_width="wrap_content" /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>MainActivity:</p>

<pre><code>public class MainActivity extends FragmentActivity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
</code></pre>

<p>CategoryListFragment class:</p>

<pre><code>public class CategoryListFragment extends ListFragment {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        String[] values = new String[] { "AAAA", "BBBB", "CCCC" };
        ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(),
                android.R.layout.simple_list_item_1, values);
        setListAdapter(adapter);
    }

}
</code></pre>
