title: ListFragment content does not appear
body: <p>Im trying to use a list fragment embedded in a parent fragment via layout XML (I've also done through fragment manager with no change). When I embed the listfragment by itself I am able to see the content from the cursor. When I override onCreateView of the parent fragment (ShoppingListActivity) and return a custom view I am no longer able to see my list fragment content.</p>
  
  <p>On the list fragment I'm using a CursorLoader and onLoadFinished always called with a cursor that has content so it's not a matter of data not being present when I use the custom layout on the parent fragement combined. The listfragment doesn't have a custom layout (I originally started with the buttons from the parent fragment being added by overriding onCreateView of the list fragment but that produced the same result)</p>
  
  <p>I also originally started out using the support library for the fragments but now use the native fragments. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent" &gt;
   &lt;Button
      android:id="@+id/btn_shopping_list_add_item_manually"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_toLeftOf="@+id/btn_shopping_list_add_item_barcode"
      android:onClick="addItemManually"
      android:text="TYPE"
      /&gt;
  
  &lt;Button
      android:id="@+id/btn_shopping_list_add_item_barcode"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_alignParentRight="true"
      android:onClick="addItemFromBarcode"
      android:text="SCAN"
      /&gt;
  &lt;fragment     android:name="com.ainesophaur.shopping.assistant.fragments.ShoppingListFragment"
      android:id="@+id/list"
      android:layout_height="0dp"
      android:layout_below="@+id/btn_shopping_list_add_item_manually"
      android:layout_alignParentLeft="true"
      android:layout_width="fill_parent" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>---Edit----</p>
  
  <p>Since I cannot upload images yet Ill draw what happens</p>
  
  <p>When onCreateView is over ridden and a custom view is provided (The above XML layout) I get</p>
  
  <h2>Button1  Button2</h2>
  
  <p>Nothing</p>
  
  <p>When I call the listview fragment directly I get</p>
  
  <p>List Item1<br />
  List Item2</p>
  
  <p>The list view fragment has a custom adapter extended from CursorAdapter and when I have the above specified XML layout returned from onCreateView then my newView and bindView of the adapter aren't called.</p>
  
  <p>I've also tried to include a listview item in the parent fragment XML (instead of including the fragment itself) and gave it the standard android ID of list and I still get the same result..if I give the list view a unique ID and call setAdapter on the list then I also get no result (ie, bindView and newView of the adapter never get called) after onLoadFinished of the cursorloader
  ---EDIT</p>
  
  <p>Now I can upload images :)</p>
  
  <p><img src="https://i.stack.imgur.com/EBe8k.png" alt="Missing List"></p>
  
  <p><img src="https://i.stack.imgur.com/QxUoU.png" alt="List Shown"></p>
  
  <hr>
  
  <p>This is the code that contains the ListFragment and the CursorAdapter </p>
  
  <p>ListFragment</p>
  
  <pre><code>public class ShoppingListFragment extends ListFragment implements
  LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
      private int mStoreID;
      private long mListID;
      private String mStoreName;
      private ShoppingListItemsAdapter adapter;
      private Context mContext;
      private Cursor mCursor;
      private static final int SHOPPING_LIST_LOADER = 0x04;
  
       CursorLoader cursorLoader;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          mContext = getActivity();
          Bundle args = getArguments();
          mListID = 4; //args.getLong("listid");
          //mStoreName = args.getString("storename");
  
      }
  
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
          mContext = getActivity();
          adapter = new ShoppingListItemsAdapter(mContext, mCursor, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
          setListAdapter(adapter);
          //setListAdapter(adapter);
          getLoaderManager().initLoader(SHOPPING_LIST_LOADER, null, this);
      }
      @Override
      public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) {
          cursorLoader = new CursorLoader(getActivity(),
                   Uri.withAppendedPath(ShoppingListProvider.CONTENT_LIST_ITEMS_URI, String.valueOf(mListID)), ShoppingDBAdapter.joinitemProj, null, null, null);
          return cursorLoader;
      }
      @Override
      public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor cursor) {
          adapter.swapCursor(cursor);
          //setListShown(true);
      }
      @Override
      public void onLoaderReset(Loader&lt;Cursor&gt; loader) {
          adapter.swapCursor(null);
      }
  
      private OnClickListener addManual = new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              Fragment fragment = new AddItemFragment();
              Bundle args = new Bundle();
              args.putLong("listid", mListID);
              fragment.setArguments(args);
              getFragmentManager().beginTransaction()
              .replace(R.id.container, fragment).addToBackStack(null)
              .commit();
  
              return;
  
          }
      };
      private static class ShoppingListItemViewHolder {
          public TextView separator;
          public TextView itemQuantity;
          public TextView itemName;
          public TextView itemPrice;
          public CharArrayBuffer quantityObtainedBuffer = new CharArrayBuffer(128);
          public CharArrayBuffer quantityNeededBuffer = new CharArrayBuffer(128);
          public CharArrayBuffer titleBuffer = new CharArrayBuffer(128);
          public CharArrayBuffer priceBuffer = new CharArrayBuffer(128);
          public CharArrayBuffer itemCategoryBuffer = new CharArrayBuffer(128);
    }
      public void addItemFromBarcode(View v)
      {
          return;
      }
  </code></pre>
  
  <p>extended CursorAdapter</p>
  
  <pre><code>private static class ShoppingListItemsAdapter extends CursorAdapter
  {
      private static final int STATE_UNKNOWN = 0;
      private static final int STATE_SECTIONED_CELL = 1;
      private static final int STATE_REGULAR_CELL = 2;
      String LAST_CATEGORYNAME = "";
      private final CharArrayBuffer mBuffer = new CharArrayBuffer(128);
      private int[] mCellStates;
  
      public ShoppingListItemsAdapter(Context context, Cursor c, int flags) {
          super(context, c, flags);
          mCellStates = (c == null) ? null : new int[c.getCount()];
      }
        @Override
          public void changeCursor(Cursor cursor) {
              super.changeCursor(cursor);
              mCellStates = (cursor == null) ? null : new int[cursor.getCount()];
          }
        @Override
          public Cursor swapCursor(Cursor cursor) {
              Cursor oldCursor = super.swapCursor(cursor);
              mCellStates = (cursor == null) ? null : new int[cursor.getCount()];
              return oldCursor;
          }
        @Override
          public void bindView(View view, Context context, Cursor cursor) {
  
            final ShoppingListItemViewHolder holder = (ShoppingListItemViewHolder) view.getTag();
            final int COLUMN_NAME_INDEX = cursor.getColumnIndex(ShoppingDBAdapter.KEY_NAME);
            final int COLUMN_ITEMCATEGORY_INDEX = cursor.getColumnIndex(ShoppingDBAdapter.KEY_CATEGORYID);
            final int COLUMN_PRICE_INDEX = cursor.getColumnIndex(ShoppingDBAdapter.KEY_PRICE);
            final int COLUMN_OBTAINED_INDEX = cursor.getColumnIndex(ShoppingDBAdapter.KEY_OBTAINED);
            final int COLUMN_NEEDED_INDEX = cursor.getColumnIndex(ShoppingDBAdapter.KEY_NEEDED);
            boolean needSeparator = false;  
            final int position = cursor.getPosition();
            cursor.copyStringToBuffer(COLUMN_NAME_INDEX, holder.titleBuffer);
            cursor.copyStringToBuffer(COLUMN_PRICE_INDEX, holder.priceBuffer);
            cursor.copyStringToBuffer(COLUMN_NEEDED_INDEX, holder.quantityNeededBuffer);
            cursor.copyStringToBuffer(COLUMN_ITEMCATEGORY_INDEX, holder.itemCategoryBuffer);
            switch (mCellStates[position]) 
               {
                    case STATE_SECTIONED_CELL:
                        needSeparator = true;
                        break;
  
                    case STATE_REGULAR_CELL:
                        needSeparator = false;
                        break;
  
                    case STATE_UNKNOWN:
                    default:
                        if (position == 0) {
                            if(holder.itemCategoryBuffer.sizeCopied &gt; 0)
                            {
                                needSeparator = true;
                                int holderStoreNameSize = holder.itemCategoryBuffer.sizeCopied;
                                String holderStoreName = "";
                                for(int i = 0; i &lt; holderStoreNameSize; i++)
                                {
                                    holderStoreName += holder.itemCategoryBuffer.data[i];
                                }
                                LAST_CATEGORYNAME = holderStoreName;
                            }
                        } 
                        else 
                        {
                            cursor.moveToPosition(position - 1);
                            cursor.copyStringToBuffer(COLUMN_ITEMCATEGORY_INDEX, mBuffer);
                            if (mBuffer.sizeCopied &gt; 0 &amp;&amp; holder.itemCategoryBuffer.sizeCopied &gt; 0) 
                            {
                                int mBufferSize = mBuffer.sizeCopied;
                                int holderStoreNameSize = holder.itemCategoryBuffer.sizeCopied;
                                String mBufferName = "";
                                String holderStoreName = "";
                                for(int i = 0; i &lt; holderStoreNameSize; i++)
                                {
                                    holderStoreName += holder.itemCategoryBuffer.data[i];
                                }
                                if(!LAST_CATEGORYNAME.equals(holderStoreName))
                                {
                                    needSeparator = true;
                                    LAST_CATEGORYNAME = holderStoreName;
                                }
                            }
                            cursor.moveToPosition(position);
                        }
                        mCellStates[position] = needSeparator ? STATE_SECTIONED_CELL : STATE_REGULAR_CELL;
                        break;
                }
            if (needSeparator) {
                  holder.separator.setText(holder.itemCategoryBuffer.data, 0 , holder.itemCategoryBuffer.sizeCopied);
                  holder.separator.setVisibility(View.VISIBLE);
              } else {
                  holder.separator.setVisibility(View.GONE);
              }
              holder.itemName.setText(holder.titleBuffer.data, 0, holder.titleBuffer.sizeCopied);
              holder.itemPrice.setText(holder.priceBuffer.data, 0, holder.priceBuffer.sizeCopied);
              holder.itemQuantity.setText(holder.quantityNeededBuffer.data, 0, holder.quantityNeededBuffer.sizeCopied);
        }
      @Override
      public View newView(Context context, Cursor cursor, ViewGroup parent) {
           View v = LayoutInflater.from(context).inflate(R.layout.fragment_shopping_list_items_row, parent, false);
           ShoppingListItemViewHolder holder = new ShoppingListItemViewHolder();
           holder.separator = (TextView)v.findViewById(R.id.separator);
           holder.itemName = (TextView)v.findViewById(R.id.item_name);
           holder.itemPrice = (TextView)v.findViewById(R.id.item_price);
           holder.itemQuantity = (TextView)v.findViewById(R.id.item_quantity);
           v.setTag(holder);
           return v;
      }
  }
  </code></pre>