// listens for the click for the user to delete the selected item displays a alert to make sure
  // the user wants to delete that item
  @Override
  public void onItemClick(AdapterView<?> parent, View v, int pos, long id) {
    cursor = dbHelper.fetchScoresForBowlerLeague(bowler, league);
    cursor.moveToPosition(pos);
    row = cursor.getLong(cursor.getColumnIndex(BowlerDatabaseAdapter.KEY_ROWID));

    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("DELETE?");
    alert.setMessage(
        "Are you sure you want to delete this record? This will delete the detailed score information too.");
    alert.setPositiveButton(
        "YES",
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            dbHelper.deleteBowlerScore(row);
            fillData();
          }
        });

    alert.setNegativeButton(
        "NO",
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            // Do Nothing

          }
        });

    alert.show();
  }
  private void fillData() {
    cursor = dbHelper.fetchScoresForBowlerLeague(bowler, league);
    startManagingCursor(cursor);

    String[] from =
        new String[] {
          BowlerDatabaseAdapter.KEY_BOWLER_NAME,
          BowlerDatabaseAdapter.KEY_LEAGUE_NAME,
          BowlerDatabaseAdapter.KEY_DATE,
          BowlerDatabaseAdapter.KEY_GAME_ONE_SCORE,
          BowlerDatabaseAdapter.KEY_GAME_TWO_SCORE,
          BowlerDatabaseAdapter.KEY_GAME_THREE_SCORE,
          BowlerDatabaseAdapter.KEY_SERIES_SCORE
        };
    int[] to =
        new int[] {
          R.id.bowler_entry,
          R.id.league_entry,
          R.id.date_entry,
          R.id.g1_entry,
          R.id.g2_entry,
          R.id.g3_entry,
          R.id.series_entry
        };

    SimpleCursorAdapter leagues =
        new SimpleCursorAdapter(this, R.layout.leaguenightlist, cursor, from, to);
    this.setListAdapter(leagues);
  }