List of usage examples for android.content ContentValues ContentValues
public ContentValues()
From source file:com.liferay.alerts.callback.VoteCallback.java
@Override public void onSuccess(JSONObject vote) { ToastUtil.show(_context, R.string.vote_success, true); try {/*from w ww . j ava2 s .c o m*/ AlertDAO dao = AlertDAO.getInstance(_context); Alert alert = dao.get(_alertId); PollsQuestion question = alert.getPollsQuestion(); alert.setPollsQuestion(question.toJSONObject(_choiceId)); ContentValues values = new ContentValues(); values.put(Alert.PAYLOAD, alert.getPayload().toString()); dao.update(_alertId, values, true); } catch (Exception e) { Log.e(_TAG, "Could not update vote in database.", e); } }
From source file:cn.code.notes.gtask.data.SqlConn.java
public SqlConn(Context context, Cursor c) { mContentResolver = context.getContentResolver(); mIsCreate = false; loadFromCursor(c); mDiffDataValues = new ContentValues(); }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.ProfileObj.java
public void handleDirectMessage(Context context, Contact from, JSONObject obj) { String name = obj.optString(NAME); String id = Long.toString(from.id); ContentValues values = new ContentValues(); values.put(Contact.NAME, name);/*from w ww. ja v a 2 s.c o m*/ context.getContentResolver().update(Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/contacts"), values, "_id=?", new String[] { id }); }
From source file:gxu.software_engineering.market.android.util.Processor.java
public static ContentValues toItem(JSONObject json) throws JSONException { ContentValues values = new ContentValues(); JSONObject category = json.getJSONObject(C.CATEGORY); JSONObject seller = json.getJSONObject(C.SELLER); values.put(C._ID, json.getLong(C.ID)); values.put(C.item.ADDED_TIME, json.getLong(C.item.ADDED_TIME)); values.put(C.item.CATEGORY, category.getString(C.category.NAME)); values.put(C.item.CLICK_TIMES, json.getLong(C.item.CLICK_TIMES)); values.put(C.item.CLOSED, json.getString(C.item.CLOSED)); values.put(C.item.DEAL, json.getString(C.item.DEAL)); values.put(C.item.DESCRIPTION, json.getString(C.item.DESCRIPTION)); values.put(C.item.EXTRA, json.getString(C.item.EXTRA)); values.put(C.item.LAST_MODIFIED_TIME, json.getLong(C.item.LAST_MODIFIED_TIME)); values.put(C.item.NAME, json.getString(C.item.NAME)); values.put(C.item.PRICE, json.getDouble(C.item.PRICE)); values.put(C.item.SELLER, seller.getString(C.user.NICK)); values.put(C.item.SELLER_ID, seller.getLong(C.ID)); values.put(C.item.CID, category.getLong(C.ID)); return values; }
From source file:net.bible.service.db.bookmark.BookmarkDBAdapter.java
public BookmarkDto insertBookmark(BookmarkDto bookmark) { // Create a new row of values to insert. ContentValues newValues = new ContentValues(); Key key = bookmark.getVerse(); String v11nName = ""; if (key instanceof VerseKey) { // must save a VerseKey's versification along with the key! v11nName = ((VerseKey) key).getVersification().getName(); }//from w w w . j av a 2s . co m // Gets the current system time in milliseconds Long now = Long.valueOf(System.currentTimeMillis()); newValues.put(BookmarkColumn.KEY, key.getOsisID()); newValues.put(BookmarkColumn.VERSIFICATION, v11nName); newValues.put(BookmarkColumn.CREATED_ON, now); long newId = db.insert(Table.BOOKMARK, null, newValues); BookmarkDto newBookmark = getBookmarkDto(newId); return newBookmark; }
From source file:br.ufc.mdcc.mpos.persistence.ProfileNetworkDao.java
/** * Adiciona os resultados obtidos no PingTask * //from w w w. j av a 2 s . co m * @param network - Objeto com os resultados do PingTask */ public void add(Network network) { openDatabase(); ContentValues cv = new ContentValues(); cv.put(F_DATE, dateFormat.format(network.getDate())); cv.put(F_LOSS, network.getLossPacket()); cv.put(F_JITTER, network.getJitter()); cv.put(F_UDP, Network.arrayToString(network.getResultPingUdp())); cv.put(F_TCP, Network.arrayToString(network.getResultPingTcp())); cv.put(F_DOWN, network.getBandwidthDownload()); cv.put(F_UP, network.getBandwidthUpload()); cv.put(F_NET_TYPE, network.getNetworkType()); cv.put(F_ENDPOINT_TYPE, network.getEndpointType()); database.insert(TABLE_NAME, null, cv); closeDatabase(); }
From source file:br.ufc.mdcc.benchimage2.dao.ResultDao.java
public void add(ResultImage results) { openDatabase();//from w w w. j av a 2s.co m ContentValues cv = new ContentValues(); cv.put(F_PHOTO_NAME, results.getConfig().getImage()); cv.put(F_FILTER_NAME, results.getConfig().getFilter()); cv.put(F_LOCAL, results.getConfig().getLocal()); cv.put(F_SIZE, results.getConfig().getSize()); cv.put(F_EXECUTION_CPU_TIME, results.getRpcProfile().getExecutionCpuTime()); cv.put(F_UPLOAD_TIME, results.getRpcProfile().getUploadTime()); cv.put(F_DOWNLOAD_TIME, results.getRpcProfile().getDonwloadTime()); cv.put(F_TOTAL_TIME, results.getTotalTime()); cv.put(F_DOWN_SIZE, results.getRpcProfile().getDownloadSize()); cv.put(F_UP_SIZE, results.getRpcProfile().getUploadSize()); cv.put(F_DATE, dateFormat.format(results.getDate())); database.insert(TABLE_NAME, null, cv); closeDatabase(); }
From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.services.transformationmanager.database.LocalTransformationDBMS.java
public boolean addTransformation(long bundleId, String transformationName, String producedEventType, List<String> requiredEventTypes, int costs) { // generate semicolon separated list of required event types String requiredEvents = ""; for (String type : requiredEventTypes) { requiredEvents += type + ";"; }//from w ww . j ava 2 s .com ContentValues values = new ContentValues(); values.put(LocalTransformationDB.COLUMN_BUNDLE_ID, bundleId); values.put(LocalTransformationDB.COLUMN_TRANSFORMATION_NAME, transformationName); values.put(LocalTransformationDB.COLUMN_PRODUCED_EVENT_TYPE, producedEventType); values.put(LocalTransformationDB.COLUMN_REQUIRED_EVENT_TYPES, requiredEvents); values.put(LocalTransformationDB.COLUMN_TRANSFORMATION_COSTS, costs); long insertId = database.insert(LocalTransformationDB.TABLE_LOCAL_TRANSFORMATIONS, null, values); return insertId != -1; }
From source file:com.bellman.bible.service.db.bookmark.BookmarkDBAdapter.java
public BookmarkDto insertBookmark(BookmarkDto bookmark) { // Create a new row of values to insert. ContentValues newValues = new ContentValues(); Key key = bookmark.getVerseRange(); String v11nName = ""; if (key instanceof VerseKey) { // must save a VerseKey's versification along with the key! v11nName = ((VerseKey<?>) key).getVersification().getName(); }/*ww w . j a va 2 s.c o m*/ // Gets the current system time in milliseconds Long now = Long.valueOf(System.currentTimeMillis()); newValues.put(BookmarkColumn.KEY, key.getOsisRef()); newValues.put(BookmarkColumn.VERSIFICATION, v11nName); newValues.put(BookmarkColumn.CREATED_ON, now); long newId = db.insert(Table.BOOKMARK, null, newValues); BookmarkDto newBookmark = getBookmarkDto(newId); return newBookmark; }
From source file:cn.code.notes.gtask.data.SqlData.java
public SqlData(Context context) { mContentResolver = context.getContentResolver(); mIsCreate = true;//from w ww.j a v a 2s. c o m mDataId = INVALID_ID; mDataMimeType = DataConstants.NOTE; mDataContent = ""; mDataContentData1 = 0; mDataContentData3 = ""; mDiffDataValues = new ContentValues(); }