List of usage examples for android.content ContentValues toString
@Override
public String toString()
From source file:at.bitfire.ical4android.AndroidTaskList.java
@SuppressLint("InlinedApi") public static Uri create(Account account, TaskProvider provider, ContentValues info) throws CalendarStorageException { info.put(TaskContract.ACCOUNT_NAME, account.name); info.put(TaskContract.ACCOUNT_TYPE, account.type); info.put(TaskLists.ACCESS_LEVEL, 0); Log.i(TAG, "Creating local task list: " + info.toString()); try {//from w w w .j a v a 2s . c o m return provider.client.insert(syncAdapterURI(provider.taskListsUri(), account), info); } catch (RemoteException e) { throw new CalendarStorageException("Couldn't create local task list", e); } }
From source file:at.bitfire.ical4android.AndroidCalendar.java
@SuppressLint("InlinedApi") public static Uri create(Account account, ContentProviderClient provider, ContentValues info) throws CalendarStorageException { info.put(Calendars.ACCOUNT_NAME, account.name); info.put(Calendars.ACCOUNT_TYPE, account.type); if (android.os.Build.VERSION.SDK_INT >= 15) { // these values are generated by ical4android info.put(Calendars.ALLOWED_AVAILABILITY, Events.AVAILABILITY_BUSY + "," + Events.AVAILABILITY_FREE + "," + Events.AVAILABILITY_TENTATIVE); info.put(Calendars.ALLOWED_ATTENDEE_TYPES, Attendees.TYPE_NONE + "," + Attendees.TYPE_OPTIONAL + "," + Attendees.TYPE_REQUIRED + "," + Attendees.TYPE_RESOURCE); }/*w w w . j a v a 2 s . c o m*/ Log.i(TAG, "Creating local calendar: " + info.toString()); try { return provider.insert(syncAdapterURI(Calendars.CONTENT_URI, account), info); } catch (RemoteException e) { throw new CalendarStorageException("Couldn't create calendar", e); } }
From source file:com.granita.icloudcalsync.resource.LocalTaskList.java
public static Uri create(Account account, ContentResolver resolver, ServerInfo.ResourceInfo info) throws LocalStorageException { final ContentProviderClient client = resolver.acquireContentProviderClient(TASKS_AUTHORITY); if (client == null) throw new LocalStorageException("No tasks provider found"); ContentValues values = new ContentValues(); values.put(TaskContract.TaskLists.ACCOUNT_NAME, account.name); values.put(TaskContract.TaskLists.ACCOUNT_TYPE, account.type); values.put(TaskContract.TaskLists._SYNC_ID, info.getURL()); values.put(TaskContract.TaskLists.LIST_NAME, info.getTitle()); values.put(TaskContract.TaskLists.LIST_COLOR, DAVUtils.CalDAVtoARGBColor(info.getColor())); values.put(TaskContract.TaskLists.OWNER, account.name); values.put(TaskContract.TaskLists.ACCESS_LEVEL, 0); values.put(TaskContract.TaskLists.SYNC_ENABLED, 1); values.put(TaskContract.TaskLists.VISIBLE, 1); Log.i(TAG, "Inserting task list: " + values.toString()); try {//w ww . ja v a2 s . com return client.insert(taskListsURI(account), values); } catch (RemoteException e) { throw new LocalStorageException(e); } }
From source file:at.bitfire.davdroid.resource.LocalTaskList.java
public static Uri create(Account account, ContentResolver resolver, ServerInfo.ResourceInfo info) throws LocalStorageException { @Cleanup("release") final ContentProviderClient client = resolver.acquireContentProviderClient(TASKS_AUTHORITY); if (client == null) throw new LocalStorageException("No tasks provider found"); ContentValues values = new ContentValues(); values.put(TaskContract.TaskLists.ACCOUNT_NAME, account.name); values.put(TaskContract.TaskLists.ACCOUNT_TYPE, account.type); values.put(TaskContract.TaskLists._SYNC_ID, info.getURL()); values.put(TaskContract.TaskLists.LIST_NAME, info.getTitle()); values.put(TaskContract.TaskLists.LIST_COLOR, info.getColor() != null ? info.getColor() : DAVUtils.calendarGreen); values.put(TaskContract.TaskLists.OWNER, account.name); values.put(TaskContract.TaskLists.ACCESS_LEVEL, 0); values.put(TaskContract.TaskLists.SYNC_ENABLED, 1); values.put(TaskContract.TaskLists.VISIBLE, 1); Log.i(TAG, "Inserting task list: " + values.toString()); try {/*from ww w. j a v a 2 s . c o m*/ return client.insert(taskListsURI(account), values); } catch (RemoteException e) { throw new LocalStorageException(e); } }
From source file:gxu.software_engineering.market.android.activity.NewItemActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish();// w ww .j av a 2 s .co m break; case R.id.discard: finish(); break; case R.id.done: Toast.makeText(this, R.string.submit, Toast.LENGTH_SHORT).show(); Log.i("null???", String.format("%s", this.name == null)); String[] data = resolveData(); try { long uid = MarketApp.marketApp().getPrefs().getLong(C.UID, -1); ContentValues values = new PostToCloud() .execute(cid + "", uid + "", data[0], data[1], data[2], data[3]).get(); Log.i("items>>>", values.toString()); getContentResolver().insert(Uri.parse(C.BASE_URI + C.ITEMS), values); Toast.makeText(this, R.string.publish_ok, Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, ItemActivity.class); intent.putExtra(C.ID, values.getAsLong(C._ID)); startActivity(intent); } catch (Exception e) { Log.wtf("receive result error!", e); Toast.makeText(this, R.string.publish_fail, Toast.LENGTH_SHORT).show(); } break; default: break; } return false; }
From source file:org.mozilla.labs.Soup.provider.AppsProvider.java
@Override public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count;/*from w w w. j av a 2 s .c o m*/ Log.d(TAG, "Update " + values.toString()); switch (sUriMatcher.match(uri)) { case APPS: count = db.update(APPS_TABLE_NAME, values, where, whereArgs); break; case APP_ID: String appId = uri.getPathSegments().get(1); // values.put(AppsContract.Apps.MODIFIED_DATE, // Long.valueOf(System.currentTimeMillis())); count = db.update(APPS_TABLE_NAME, values, Apps._ID + "=" + appId + (!TextUtils.isEmpty(where) ? " AND (" + where + ')' : ""), whereArgs); break; default: throw new IllegalArgumentException("Unknown URI " + uri); } getContext().getContentResolver().notifyChange(uri, null); return count; }
From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.services.transformationmanager.database.LocalTransformationDBMS.java
public void storeJsonData(ArrayList<ContentValues> vArray) { for (ContentValues values : vArray) { long insertId = database.insert(LocalTransformationDB.TABLE_JSON_DATA_EXCHANGE, null, values); if (insertId == -1) { Log.e(TAG, "addJsonData failed at:[" + values.toString() + "]"); }/*from ww w. j ava 2 s . c o m*/ } }
From source file:com.popumovies.DetailActivityFragment.java
private void onClickFavorite(View v, Uri mUri) { v.setSelected(!v.isSelected());//w w w . ja v a2 s . com ContentValues movieValues = new ContentValues(); movieValues.put(MovieContract.MovieEntry.COLUMN_FAVORITE, v.isSelected()); Log.d(LOG_TAG, "calling update with args: uri=>" + mUri + ",mv=>" + movieValues.toString()); getActivity().getContentResolver().update(mUri, movieValues, null, null); // List should be refreshed // I would expect the observer from the ContentProvider to detect the chage, but // it seems to be missing something. // Some comments point to adapter.notifyDataSetChanged(); MainActivityFragment mf = (MainActivityFragment) getActivity().getSupportFragmentManager() .findFragmentByTag(MainActivity.MAINFRAGMENT_TAG); mf.restartLoader(); }
From source file:gov.nasa.arc.geocam.geocam.CameraPreviewActivity.java
private void saveWithAnnotation() { try {/*from w ww . ja v a 2 s . c o m*/ mImageData.put("tag", mImageTag); mImageData.put("note", mImageNote); Log.d(GeoCamMobile.DEBUG_ID, "Saving image with data: " + mImageData.toString()); } catch (JSONException e) { Log.d(GeoCamMobile.DEBUG_ID, "Error while adding annotation to image"); } ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.DESCRIPTION, mImageData.toString()); getContentResolver().update(mImageUri, values, null, null); Log.d(GeoCamMobile.DEBUG_ID, "Updating " + mImageUri.toString() + " with values " + values.toString()); // Add image URI to upload queue try { mService.addToUploadQueue(mImageUri.toString()); } catch (RemoteException e) { Log.d(GeoCamMobile.DEBUG_ID, "Error talking to upload service while adding uri: " + mImageUri.toString() + " - " + e); } this.finish(); }
From source file:com.money.manager.ex.MmxContentProvider.java
private void logTableInsert(Dataset dataset, ContentValues values) { String log = "INSERT INTO " + dataset.getSource(); if (values != null) { log += " VALUES ( " + values.toString() + ")"; }//from w w w . j a v a 2 s. co m Timber.d(log); }