Code example for ContentValues

Methods: puttoString

0
	public void close() { 
		mDbHelper.close();
	} 
	 
	public ContentValues seedNewRow() {
		ContentValues initialValues = new ContentValues();
		initialValues.put(KEY_UPLOADED, 0);
		initialValues.put(KEY_CREATED, System.currentTimeMillis());
		 
		return initialValues;
	} 
	 
	// Add a track 
	public UploadQueueRow addTrackToQueue(long trackId) {
		ContentValues initialValues = seedNewRow();
		initialValues.put(KEY_TYPE, TYPE_TRACK);
		initialValues.put(KEY_PRIORITY, GeoCamMobile.TRACK_PRIORITY);
		initialValues.put(KEY_FID, trackId);
		 
		Log.d(TAG, "Inserting new track into upload queue: " + initialValues.toString());
		 
		long rowId = mDb.insert(DATABASE_TABLE, null, initialValues);
		return new TrackRow(rowId, trackId);
	} 
	 
	public UploadQueueRow addToQueue(String uri, int downsample) {
		ContentValues initialValues = seedNewRow();
		initialValues.put(KEY_TYPE, TYPE_IMAGE);
		 
		if (GeoCamMobile.PHOTO_PRIORITIES.containsKey(downsample)) {
			initialValues.put(KEY_PRIORITY, GeoCamMobile.PHOTO_PRIORITIES.get(downsample));
		} else { 
			initialValues.put(KEY_PRIORITY, 0);
		} 
		 
		initialValues.put(KEY_URI, uri);
		initialValues.put(KEY_DOWNSAMPLE, downsample);
		 
		Log.d(TAG, "Inserting into upload queue: " + initialValues.toString());
		 
		long rowId = mDb.insert(DATABASE_TABLE, null, initialValues);
		return new ImageRow(rowId, uri, downsample);
	}