title: Android - Populating a listview using fragments and a Simple cursor adapter
body: <p>I know that this question is probably asked a hundred times so far, but i still haven't manage to solve my problem. I have one activity that's comprised of 2 fragments. One fragment is a form that adds information to the database:</p>
  
  <pre><code>**R.layout.fragment_add_server:**
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  ...
  &lt;LinearLayout
      android:id="@+id/nameLinear"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_marginBottom="5dp"
      android:layout_marginLeft="5dp" &gt;
  
      &lt;TextView
          android:id="@+id/nameText"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="70"
          android:text="@string/strName"
          android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
      &lt;EditText
          android:id="@+id/editName"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="30"
          android:hint="@string/editName" /&gt;
  &lt;/LinearLayout&gt;
  ...
  </code></pre>
  
  <p>And another fragment that's just a listview. </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/georgeback" 
  android:orientation="vertical" &gt;
  
  &lt;ListView
      android:id="@+id/listView1"
      android:layout_width="wrap_content"
      android:layout_height="0dp"
      android:layout_weight="60" &gt;
  &lt;/ListView&gt;
  
  &lt;Button
      android:id="@+id/connect"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal"
      android:text="@string/connectBTN" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>That fragment, the listview, i want to populate it with whatever there is in the database, and auto refresh when something new is added(haven't got to that stage yet). When i'm using the following code below i manage to populate the listview with the entire fragment(i.e i see the listboxes,buttons etc and i can even interact with them. Inception.) instead of just the data. </p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      View view = inflater.inflate(R.layout.fragment_select_server,
              container, false);
      Cursor mNotesCursor = mDbHelper.fetchAllNotes();
      String[] from = new String[]{mDbHelper.KEY_TITLE};
      int[] to = new int[]{R.id.editName};
      mCurAdapter = new SimpleCursorAdapter(view.getContext(),R.layout.fragment_add_server,mNotesCursor,from,to,0);
  
      mMyListView=(ListView)view.findViewById(R.id.listView1);
      mMyListView.setAdapter(mCurAdapter);
  
      return view;
  }
  </code></pre>
  
  <p>I believe that i'm doing something wrong with the from and to fields of the constructor. Any idea why i'm getting as an output the entire fragment view and not just the data in the database? Any other suggestions?</p>