title: Implementing a CursorAdapter to get DB rowID's of ListItems in a ListView
body: <p>I'm trying to implement a CursorAdapter in my Android App. I read different tutorials and tried out different things but it won't work! 
  I found one question here very similar to mine but I didn't get the idea out of it.</p>
  
  <p>Here's the thing:</p>
  
  <p>I got a Database with multiple tables and foreign keys and so on.  I wrote a (tested and working) Database including an
  extension of the SQLiteHelper class to work properly. The DB-Class containts a lot of methods to get various operations
  on that DB like: insert, update, delete, alter and some special needs....</p>
  
  <p>My Problem is the following:
  I have written a method which returns all Data containing (all rows) in the Database which i want to present
  in a ListView. The returning object is a wrapped  ArrayList> . I got the thing working all fine 
  with an ListViewAdapter but then i came to my problem which now almost drives me crazy:</p>
  
  <p>The User shall click a random item in that specific list (which contains all rows from the DB) and then i want to
  update that specific row in the DB with some new data the user put into a EditText box. Pretty simple task actually but I think I just don't understand the usage of the CursorAdapter.</p>
  
  <p>My questions now:</p>
  
  <ol>
  <li>What does my DB-Method have to return (or look alike) that the CursorAdapter can handle it....</li>
  <li>How do I have to implement the Adapter that it just fulfill this one task (retrieving the correct rowID of the DB entry in the list)</li>
  </ol>
  
  <p>Here is my method retrieving the data from the DB</p>
  
  <pre class="lang-java prettyprint-override"><code>public ArrayList&lt;ArrayList&lt;Object&gt;&gt; getAll()
      {
          ArrayList&lt;ArrayList&lt;Object&gt;&gt; allRows = new ArrayList&lt;ArrayList&lt;Object&gt;&gt;();
  
          //Cursorobjekt haelt die Daten einer Zeile und dient dazu in diesen zu iterieren
          Cursor myCursor1,myCursor2,myCursor3;
  
  
          myCursor1 = db.query 
          (       "Faecher",
                  new String[] { "id" , FACH_NAME, FACH_ART },                    
                  null, null, null, null, null
          );
          // Den Pointer an die erste Stelle ruecken
          myCursor1.moveToFirst();
  
  
          myCursor2 = db.query
          (
                  "Ort",
                  new String[]{"id" , ORT_RAUM , ORT_GEBAEUDE},
                  null,null,null,null,null,null
          );
          myCursor2.moveToFirst();
  
  
  
          myCursor3 = db.query
          (
                  "Profs",
                  new String[]{"id", PROFS_NAME, PROFS_SNAME, FKEY_GENDER_ID},
                  null,null,null,null,null,null
          );
          myCursor3.moveToFirst();
  
  
          for(int i=0; i &lt; myCursor1.getCount(); i++)
          {
              ArrayList&lt;Object&gt; row1 = new ArrayList&lt;Object&gt;();
  
              row1.add(myCursor1.getLong(0));
              row1.add(myCursor1.getString(1));
              row1.add(myCursor1.getString(2));
              row1.add(myCursor2.getLong(0));
              row1.add(myCursor2.getString(1));
              row1.add(myCursor2.getString(2));
              row1.add(myCursor3.getLong(0));
              row1.add(myCursor3.getString(1));
              row1.add(myCursor3.getString(2));
              row1.add(myCursor3.getLong(3));
              allRows.add(row1);
  
              myCursor1.moveToNext();
              myCursor2.moveToNext();
              myCursor3.moveToNext();
          }
  
          myCursor1.close();
          myCursor2.close();
          myCursor3.close();
  
          return allRows;
      }
  </code></pre>
  
  <p>The Adapter is empty right now because my code was real crap and now looks like this hull:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class SubjectListAdapter extends CursorAdapter
  {
      private LayoutInflater myInflater;
  
  
      public SubjectListAdapter(Context context, Cursor c) 
      {
          super(context, c);
  
      }
  
      @Override
      public View newView(Context context, Cursor myCursor, ViewGroup parent) 
      {
  
          return null;
      }
  
      @Override
      public void bindView(View parent, Context context, Cursor myCursor) 
      {
  
  
      }
  
  }
  </code></pre>
  
  <p>I hope someone can help me out with my problem or give me a hint where I have to go to get this working.</p>