title: Pass number of repeated database column instances into TextView with CursorAdapter
body: <p>I am fairly beginner and currently writing an app which contains a list of Restaurants. I am using a SQLite database to store the "Restaurant" objects and am using a CursorAdapter to display them into a ListView.</p>
  
  <p>Currently the fields are a photo, the name of the restaurant and its location.</p>
  
  <p>I want to have one more TextView which shows how many times that certain restaurant appears in the database. I'm having trouble figuring out how to do this inside my CursorAdapter class.</p>
  
  <p>Below is my bindView method in the CursorAdapter class where the existing views get updated.</p>
  
  <pre><code>@Override
  public void bindView(View view, Context context, Cursor cursor) {
  
      // Find individual views that we want to modify in the list item layout
      ImageView foodImageView = (ImageView) view.findViewById(R.id.food_image_view);
      TextView restaurantNameTextView = (TextView) view.findViewById(R.id.restaurant_name_text_view);
      TextView restaurantLocationTextView = (TextView) view.findViewById(R.id.restaurant_location_text_view);
  
      // Find the columns of restaurant attributes that we're interested in
      int foodPictureColumnIndex = cursor.getColumnIndex(RestaurantEntry.COLUMN_FOOD_PHOTO_URL);
      int restaurantNameColumnIndex = cursor.getColumnIndex(RestaurantEntry.COLUMN_RESTAURANT_NAME);
      int restaurantLocationColumnIndex = cursor.getColumnIndex(RestaurantEntry.COLUMN_RESTAURANT_LOCATION);
  
      // Read the restaurant attributes from the Cursor for the current restaurant
      String foodPhoto = cursor.getString(foodPictureColumnIndex);
      String restaurantName = cursor.getString(restaurantNameColumnIndex);
      String restaurantLocation = cursor.getString(restaurantLocationColumnIndex);
  
      // Update the Views with the attributes for the current restaurant
      Picasso.with(mContext).load(foodPhoto).into(foodImageView);
      restaurantNameTextView.setText(restaurantName);
      restaurantLocationTextView.setText(restaurantLocation);
  }
  </code></pre>