public ArrayList<AuctionItem> getAllAuctions() {
    ArrayList<AuctionItem> allAuctions = new ArrayList<AuctionItem>();
    SQLiteDatabase db = dbHelper.getReadableDatabase();

    Cursor cursor = db.rawQuery("SELECT * FROM " + AUCTIONS_TABLE + ";", null);

    if (cursor != null) {
      if (cursor.moveToFirst()) {
        while (cursor.isAfterLast() == false) {
          AuctionItem auction = new AuctionItem();

          auction.id = cursor.getInt(cursor.getColumnIndex("ID"));
          auction.name = cursor.getString(cursor.getColumnIndex(AUCTIONS_NAME));
          auction.starting_price =
              Double.parseDouble(cursor.getString(cursor.getColumnIndex(AUCTIONS_STARTING_PRICE)));
          auction.created_by = cursor.getString(cursor.getColumnIndex(AUCTIONS_CREATED_BY));
          auction.highest_bid =
              Double.parseDouble(cursor.getString(cursor.getColumnIndex(AUCTIONS_HIGHEST_BID)));
          auction.highest_bidder = cursor.getString(cursor.getColumnIndex(AUCTIONS_HIGHEST_BIDDER));
          auction.hours_active =
              Integer.parseInt(cursor.getString(cursor.getColumnIndex(AUCTIONS_HOURS_ACTIVE)));

          allAuctions.add(auction);
          cursor.moveToNext();
        }
      }
      cursor.close();
    }

    return allAuctions;
  }
  public AuctionItem getAuctionItem(int id) {
    db = dbHelper.getReadableDatabase();
    AuctionItem auction = new AuctionItem();

    Cursor cursor =
        db.query(
            AUCTIONS_TABLE,
            null,
            " ID" + " =?",
            new String[] {String.valueOf(id)},
            null,
            null,
            null);
    if (cursor.getCount() < 1) // item doesn't exist
    {
      cursor.close();
      return null;
    }
    cursor.moveToFirst();

    auction.name = cursor.getString(cursor.getColumnIndex(AUCTIONS_NAME));
    auction.starting_price =
        Double.parseDouble(cursor.getString(cursor.getColumnIndex(AUCTIONS_STARTING_PRICE)));
    auction.created_by = cursor.getString(cursor.getColumnIndex(AUCTIONS_CREATED_BY));
    auction.highest_bid =
        Double.parseDouble(cursor.getString(cursor.getColumnIndex(AUCTIONS_HIGHEST_BID)));
    auction.highest_bidder = cursor.getString(cursor.getColumnIndex(AUCTIONS_HIGHEST_BIDDER));
    auction.hours_active =
        Integer.parseInt(cursor.getString(cursor.getColumnIndex(AUCTIONS_HOURS_ACTIVE)));

    db.close();
    return auction;
  }