コード例 #1
0
 public ContentValues generateValuesMarket(Market market) {
   ContentValues values = new ContentValues();
   values.put(Market.MarketEntry.COLUMN_NAME, market.getName());
   values.put(Market.MarketEntry.COLUMN_LATITUDE, market.getLatitude());
   values.put(Market.MarketEntry.COLUMN_LONGITUDE, market.getLongitude());
   values.put(Market.MarketEntry.COLUMN_ADDRESS, market.getAddress());
   return values;
 }
コード例 #2
0
 public ArrayList<Market> getMarkets() {
   ArrayList<Market> markets = new ArrayList<Market>();
   SQLiteDatabase dataBase = dbHelper.getReadableDatabase();
   Cursor cursor =
       dataBase.query(Market.MarketEntry.TABLE_NAME, null, null, null, null, null, null);
   if (cursor.moveToFirst()) {
     while (cursor.isAfterLast() == false) {
       Market market = new Market();
       market.setIdMarket(cursor.getInt(Market.MarketEntry.INDEX_ENTRY_ID));
       market.setName(cursor.getString(Market.MarketEntry.INDEX_NAME));
       market.setLatitude(Double.valueOf(cursor.getString(Market.MarketEntry.INDEX_LATITUDE)));
       market.setLongitude(Double.valueOf(cursor.getString(Market.MarketEntry.INDEX_LONGITUDE)));
       market.setAddress(cursor.getString(Market.MarketEntry.INDEX_ADDRESS));
       markets.add(market);
       cursor.moveToNext();
     }
   }
   return markets;
 }