List of usage examples for android.content ContentValues put
public void put(String key, byte[] value)
From source file:com.creationgroundmedia.popularmovies.sync.MovieSyncAdapter.java
private int deleteOldEntriesFromDb() { final String NOT_FAVE_SELECTION = MoviesContract.MovieEntry.COLUMN_FAVORITE + " != 1"; final String NOT_FRESH_AND_NOT_FAVE_SELECTION = MoviesContract.MovieEntry.COLUMN_FRESH + " != 1 AND " + NOT_FAVE_SELECTION;// w w w . j a va2s. c o m int rows; // Get rid of anything not FRESH and not FAVORITE rows = mContext.getContentResolver().delete(MoviesContract.MovieEntry.CONTENT_URI, NOT_FRESH_AND_NOT_FAVE_SELECTION, null); // Log.d(LOG_TAG, "deleted " + rows + " \'" + NOT_FRESH_AND_NOT_FAVE_SELECTION + "\'"); ContentValues values = new ContentValues(); // Set everything to no longer FRESH values.put(MoviesContract.MovieEntry.COLUMN_FRESH, "0"); rows = mContext.getContentResolver().update(MoviesContract.MovieEntry.CONTENT_URI, values, NOT_FAVE_SELECTION, null); // Log.d(LOG_TAG, "updated \'" + NOT_FAVE_SELECTION + "\' " + rows + " to NOT_FRESH"); return rows; }
From source file:com.moez.QKSMS.mmssms.Transaction.java
private static Uri createAddr(Context context, String id, String addr) throws Exception { ContentValues addrValues = new ContentValues(); addrValues.put("address", addr); addrValues.put("charset", "106"); addrValues.put("type", 151); // TO Uri addrUri = Uri.parse("content://mms/" + id + "/addr"); Uri res = context.getContentResolver().insert(addrUri, addrValues); return res;/*from w ww. j ava 2 s . co m*/ }
From source file:com.kevinquan.android.location.SimpleRecordedLocation.java
public ContentValues getContentValues() { ContentValues values = new ContentValues(); values.put(COLUMN_LATITUDE, getLatitude()); values.put(COLUMN_LONGITUDE, getLongitude()); values.put(COLUMN_ACCURACY, getAccuracy()); values.put(COLUMN_ALTITUDE, getAltitude()); values.put(COLUMN_BEARING, getBearing()); values.put(COLUMN_SPEED, getSpeed()); values.put(COLUMN_RECORDED_AT, getRecordedAt()); values.put(COLUMN_PROVIDER_ID, getProvider().getDbId()); return values; }
From source file:com.yuntongxun.ecdemo.storage.IMessageSqlManager.java
public static void updateMsgReadCount(String msgId, int count) { try {//from w ww.j a va2 s . c o m ContentValues values = new ContentValues(); values.put(IMessageColumn.readCount, count); getInstance().sqliteDB().update(DatabaseHelper.TABLES_NAME_IM_MESSAGE, values, "msgid = ?", new String[] { msgId }); } catch (Exception e) { e.printStackTrace(); } finally { } }
From source file:com.cloudmine.api.db.RequestDBOpenHelper.java
public void insertRequest(ContentValues requestValues, ContentValues[] headerValues) { SQLiteDatabase db = getWritableDatabase(); db.beginTransaction();/*from w w w . j a va 2 s . c om*/ try { long requestId = db.insertOrThrow(REQUEST_DATABASE_TABLE, null, requestValues); throwIfFailed(requestId); for (ContentValues headerValue : headerValues) { headerValue.put(KEY_HEADER_REQUEST_FK, requestId); long result = db.insertOrThrow(HEADER_DATABASE_TABLE, null, headerValue); throwIfFailed(result); } db.setTransactionSuccessful(); } finally { db.endTransaction(); } }
From source file:com.android.mail.browse.AttachmentActionHandler.java
public void cancelAttachment() { final ContentValues params = new ContentValues(1); params.put(AttachmentColumns.STATE, AttachmentState.NOT_SAVED); mCommandHandler.sendCommand(mAttachment.uri, params); }
From source file:com.yuntongxun.ecdemo.storage.IMessageSqlManager.java
public static void updateMsgReadStatus(String msgId, boolean isRead) { try {/*w ww . j av a2s. com*/ ContentValues values = new ContentValues(); values.put(IMessageColumn.READ_STATUS, isRead ? 1 : 0); getInstance().sqliteDB().update(DatabaseHelper.TABLES_NAME_IM_MESSAGE, values, "msgid = ?", new String[] { msgId }); } catch (Exception e) { e.printStackTrace(); } finally { } }
From source file:com.yuntongxun.ecdemo.storage.IMessageSqlManager.java
public static void updateMsgReadCount(String msgId) { long count = isReadMsg(msgId); try {//from w w w. j a v a2s . c o m ContentValues values = new ContentValues(); values.put(IMessageColumn.readCount, count + 1); getInstance().sqliteDB().update(DatabaseHelper.TABLES_NAME_IM_MESSAGE, values, "msgid = ?", new String[] { msgId }); } catch (Exception e) { e.printStackTrace(); } finally { } }
From source file:ceruleanotter.github.com.sunshine.FetchWeatherTask.java
private long insertLocationInDatabase(String locationSetting, String cityName, double lat, double lon) { Log.v(LOG_TAG, "inserting " + cityName + ", with coord: " + lat + ", " + lon); // First, check if the location with this city name exists in the db Cursor cursor = mContext.getContentResolver().query(LocationEntry.CONTENT_URI, new String[] { LocationEntry._ID }, LocationEntry.COLUMN_LOCATION_SETTING + " = ?", new String[] { locationSetting }, null); if (cursor.moveToFirst()) { Log.v(LOG_TAG, "Found it in the database!"); int locationIdIndex = cursor.getColumnIndex(LocationEntry._ID); return cursor.getLong(locationIdIndex); } else {//from w ww . j av a 2s. co m Log.v(LOG_TAG, "Didn't find it in the database, inserting now!"); ContentValues locationValues = new ContentValues(); locationValues.put(LocationEntry.COLUMN_LOCATION_SETTING, locationSetting); locationValues.put(LocationEntry.COLUMN_CITY_NAME, cityName); locationValues.put(LocationEntry.COLUMN_COORD_LAT, lat); locationValues.put(LocationEntry.COLUMN_COORD_LONG, lon); Uri locationInsertUri = mContext.getContentResolver().insert(LocationEntry.CONTENT_URI, locationValues); return ContentUris.parseId(locationInsertUri); } }
From source file:com.android.mail.browse.AttachmentActionHandler.java
public void startRedownloadingAttachment(Attachment attachment) { final ContentValues params = new ContentValues(2); params.put(AttachmentColumns.STATE, AttachmentState.REDOWNLOADING); params.put(AttachmentColumns.DESTINATION, attachment.destination); mCommandHandler.sendCommand(attachment.uri, params); }