title: How to save a ListView to database in one go
body: <p>I am new to Android programming and have a basic question. </p>
  
  <p>I have created a <code>ListActivity</code> where each row in its <code>ListView</code> has a <code>TextView</code> and a <code>RatingBar</code>. I am able to display values in the <code>TextView</code> and <code>RatingBar</code> by reading them from a pre-populated database; I am doing this via a custom <code>CursorAdapter</code> and it's <code>bindView()</code> method, i.e.</p>
  
  <pre><code>public class MyCursorAdapter extends CursorAdapter {
      ...
  
      public void bindView(View view, Context context, final Cursor cursor) {
          TextView name = (TextView)view.findViewById(R.id.name);
          name.setText(cursor.getString(cursor.getColumnIndex(MyDbAdapter.KEY_NAME)));
          RatingBar rating = (RatingBar)view.findViewById(R.id.life_bar_rating);
          rating.setRating(cursor.getFloat(cursor.getColumnIndex(MyDbAdapter.KEY_RATING_VALUE)));
      }
  
      ...
  }
  </code></pre>
  
  <p>Now, my problem is that in my <code>ListActivity</code> I want the user to be able to click a "Save" button so that all changes are saved to the database in one go?. How would I iterate through the adapter to get the row ID and rating values so they can be saved (or is there another better way of doing this?).</p>
  
  <p>The reason why I want to do a save in one go is because I thought it would be bad practice to update the database every time the user makes a change to a single rating (even though this is easier) as this causes more wear and tear on flash memory. I may be wrong about this, but I thought that there are a limited number of reads and writes with flash memory.</p>