List of usage examples for android.content ContentValues ContentValues
private ContentValues(Parcel in)
From source file:at.bitfire.davdroid.syncadapter.ContactsSyncManager.java
@Override protected void prepare() throws ContactsStorageException { // prepare local address book localCollection = new LocalAddressBook(account, provider); LocalAddressBook localAddressBook = localAddressBook(); String url = remote.url;//from w ww . ja v a 2 s .c o m String lastUrl = localAddressBook.getURL(); if (!url.equals(lastUrl)) { App.log.info("Selected address book has changed from " + lastUrl + " to " + url + ", deleting all local contacts"); localAddressBook.deleteAll(); } // set up Contacts Provider Settings ContentValues values = new ContentValues(2); values.put(ContactsContract.Settings.SHOULD_SYNC, 1); values.put(ContactsContract.Settings.UNGROUPED_VISIBLE, 1); localAddressBook.updateSettings(values); collectionURL = HttpUrl.parse(url); davCollection = new DavAddressBook(httpClient, collectionURL); }
From source file:at.bitfire.ical4android.AndroidTaskList.java
protected AndroidTask[] queryTasks(String where, String[] whereArgs) throws CalendarStorageException { where = (where == null ? "" : "(" + where + ") AND ") + Tasks.LIST_ID + "=?"; whereArgs = ArrayUtils.add(whereArgs, String.valueOf(id)); @Cleanup// w w w. j a va 2s . co m Cursor cursor = null; try { cursor = provider.client.query(syncAdapterURI(provider.tasksUri()), taskBaseInfoColumns(), where, whereArgs, null); } catch (RemoteException e) { throw new CalendarStorageException("Couldn't query calendar events", e); } List<AndroidTask> tasks = new LinkedList<>(); while (cursor != null && cursor.moveToNext()) { ContentValues baseInfo = new ContentValues(cursor.getColumnCount()); DatabaseUtils.cursorRowToContentValues(cursor, baseInfo); tasks.add(taskFactory.newInstance(this, cursor.getLong(0), baseInfo)); } return tasks.toArray(taskFactory.newArray(tasks.size())); }
From source file:at.bitfire.ical4android.AndroidCalendar.java
protected AndroidEvent[] queryEvents(String where, String[] whereArgs) throws CalendarStorageException { where = (where == null ? "" : "(" + where + ") AND ") + Events.CALENDAR_ID + "=?"; whereArgs = ArrayUtils.add(whereArgs, String.valueOf(id)); @Cleanup//from w w w.ja va 2 s . c om Cursor cursor = null; try { cursor = provider.query(syncAdapterURI(Events.CONTENT_URI), eventBaseInfoColumns(), where, whereArgs, null); } catch (RemoteException e) { throw new CalendarStorageException("Couldn't query calendar events", e); } List<AndroidEvent> events = new LinkedList<>(); while (cursor != null && cursor.moveToNext()) { ContentValues baseInfo = new ContentValues(cursor.getColumnCount()); DatabaseUtils.cursorRowToContentValues(cursor, baseInfo); events.add(eventFactory.newInstance(this, cursor.getLong(0), baseInfo)); } return events.toArray(eventFactory.newArray(events.size())); }