Code example for FragmentActivity

Methods: getSupportFragmentManager, onCreate

public class FragmentListArraySupport extends FragmentActivity { 
    protected void onCreate(Bundle savedInstanceState) {
        // Create the list fragment and add it as our sole content. 
        if (getSupportFragmentManager().findFragmentById( == null) {
            ArrayListFragment list = new ArrayListFragment();
            getSupportFragmentManager().beginTransaction().add(, list).commit();
    public static class ArrayListFragment extends ListFragment {
        public void onActivityCreated(Bundle savedInstanceState) {
            setListAdapter(new ArrayAdapter<String>(getActivity(),
Stop searching for code, let great code find you!  Add Codota to your java IDE