ContentValues getAsLong - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ContentValues getAsLong method.

This code example shows how to use the following methods:getAsLong, getAsString
                RemoteModelDao.getOutstandingEntryFlag(RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING); 
    } 
 
    @Override 
    protected int createOutstandingEntries(long modelId, ContentValues modelSetValues) {
        Long tagDataId = modelSetValues.getAsLong(TagMetadata.TAG_ID.name);
        String memberId = modelSetValues.getAsString(TagMemberMetadata.USER_UUID.name);
        Long deletionDate = modelSetValues.getAsLong(TagMetadata.DELETION_DATE.name);
        if (tagDataId == null || tagDataId == AbstractModel.NO_ID || RemoteModel.isUuidEmpty(memberId))
            return -1; 
 
        TagOutstanding to = new TagOutstanding();
        to.setValue(OutstandingEntry.ENTITY_ID_PROPERTY, tagDataId);
        to.setValue(OutstandingEntry.CREATED_AT_PROPERTY, DateUtilities.now());
 
        String addedOrRemoved = NameMaps.MEMBER_ADDED_COLUMN;
        if (deletionDate != null && deletionDate > 0)
            addedOrRemoved = NameMaps.MEMBER_REMOVED_COLUMN;
 
        to.setValue(OutstandingEntry.COLUMN_STRING_PROPERTY, addedOrRemoved);
7
CodeRank
This code example shows how to use the following methods:getAsLong, getAsString, put
    } 
 
    public void testSetTimeRelatedValues_Recurring_AllDay_Exception () throws IOException { 
        CalendarSyncAdapter adapter = getTestSyncAdapter(CalendarSyncAdapter.class);
        EasCalendarSyncParser p = adapter.new EasCalendarSyncParser(getTestInputStream(), adapter);
        ContentValues cv = new ContentValues();
 
        // Recurrence exception for all-day event; the exception is NOT all-day 
        GregorianCalendar startCalendar = new GregorianCalendar(2010, 5, 17, 8, 30);
        Long startTime = startCalendar.getTimeInMillis();
        GregorianCalendar endCalendar = new GregorianCalendar(2010, 5, 17, 9, 30);
        Long endTime = endCalendar.getTimeInMillis();
        cv.put(Events.ORIGINAL_ALL_DAY, 1);
        GregorianCalendar instanceCalendar = new GregorianCalendar(2010, 5, 17, 8, 30);
        cv.put(Events.ORIGINAL_INSTANCE_TIME, instanceCalendar.getTimeInMillis());
        p.setTimeRelatedValues(cv, startTime, endTime, 0);
 
        // The original instance time should have hour/min/sec zero'd out 
        GregorianCalendar testCalendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        testCalendar.set(2010, 5, 17, 0, 0, 0);

6
CodeRank
This code example shows how to use the following methods:containsKey, getAsLong, getAsString, put
				contentValues.put(entry.getValue(), contentValues.getAsInteger(entry.getKey())); 
				contentValues.remove(entry.getKey()); 
			} 
		}*/ 
		 
		if(getId()==0)contentValues.put("_id", UUID.randomUUID().getMostSignificantBits());
	} 
	 
	public long getId(){ 
		if(contentValues.containsKey("_id") && contentValues.getAsString("_id").length()>0)
			return contentValues.getAsLong("_id");
		else return 0; 
	} 
	 
	public String getEntityName() {
		return entityName;
	} 
	 
	public Map<String,String> getIndexes(){
		return indexes;
6
CodeRank
This code example shows how to use the following methods:getAsByteArray, getAsInteger, getAsLong
                    nRet = 1;
                break; 
 
            case FILE_NAME:
                try { 
                    long lOffset = values.getAsLong("offset");
                    byte [] buf = values.getAsByteArray(CHUNK);
                    int    nLength = values.getAsInteger(LENGTH);
                    if ((buf != null) && (nLength > 0)) {
                        File f = new File(selection);
                        dstFile = new FileOutputStream(f, (lOffset == 0 ? false : true));
                        dstFile.write(buf,0, nLength);
                        dstFile.flush();
                        dstFile.close();
                        nRet = nLength;
                    } 
                } catch (FileNotFoundException fnfe) {
                    fnfe.printStackTrace();
                } catch (IOException ioe) {
                    try { 
7
CodeRank
This code example shows how to use the following methods:getAsLong, getAsString, put
		 
	} 
 
	@Override 
	public void onBeforeUpdate(DBHelper dbHelper, SQLiteDatabase db, DataSourceRequest dataSourceRequest, ContentValues contentValues) {
		String value = contentValues.getAsLong(UID) + contentValues.getAsString(BODY) + contentValues.getAsLong(DATE);
		contentValues.put(ID, HashUtils.generateId(value));		
	} 
	 
} 
6
CodeRank
This code example shows how to use the following methods:getAsByteArray, getAsInteger, getAsLong
                    nRet = 1;
                break; 
 
            case FILE_NAME:
                try { 
                    long lOffset = values.getAsLong("offset");
                    byte [] buf = values.getAsByteArray(CHUNK);
                    int    nLength = values.getAsInteger(LENGTH);
                    if ((buf != null) && (nLength > 0)) {
                        File f = new File(selection);
                        dstFile = new FileOutputStream(f, (lOffset == 0 ? false : true));
                        dstFile.write(buf,0, nLength);
                        dstFile.flush();
                        dstFile.close();
                        nRet = nLength;
                    } 
                } catch (FileNotFoundException fnfe) {
                    fnfe.printStackTrace();
                } catch (IOException ioe) {
                    try { 
7
CodeRank
This code example shows how to use the following methods:getAsLong, getAsString, put
    } 
 
    public void testSetTimeRelatedValues_AllDay() throws IOException { 
        CalendarSyncAdapter adapter = getTestSyncAdapter(CalendarSyncAdapter.class);
        EasCalendarSyncParser p = adapter.new EasCalendarSyncParser(getTestInputStream(), adapter);
        ContentValues cv = new ContentValues();
        GregorianCalendar startCalendar = new GregorianCalendar(2010, 5, 10, 8, 30);
        Long startTime = startCalendar.getTimeInMillis();
        GregorianCalendar endCalendar = new GregorianCalendar(2010, 5, 11, 8, 30);
        Long endTime = endCalendar.getTimeInMillis();
        cv.put(Events.RRULE, "FREQ=WEEKLY;BYDAY=MO");
        p.setTimeRelatedValues(cv, startTime, endTime, 1);
 
        // The start time should have hour/min/sec zero'd out 
        startCalendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        startCalendar.set(2010, 5, 10, 0, 0, 0);
        startCalendar.set(GregorianCalendar.MILLISECOND, 0);
        startTime = startCalendar.getTimeInMillis();
        assertEquals(startTime, cv.getAsLong(Events.DTSTART));
 

7
CodeRank
This code example shows how to use the following methods:getAsLong, put
		} 
	} 
 
	@Override 
	public void onBeforeListUpdate(DBHelper dbHelper, SQLiteDatabase db, DataSourceRequest dataSourceRequest, int position, ContentValues contentValues) {
		contentValues.put(POSITION, position);
		contentValues.put(ID, HashUtils.generateId(contentValues.getAsLong(UID) + "_" + contentValues.getAsLong(CHAT_ID)));
	} 
	 
} 
6
CodeRank
This code example shows how to use the following methods:containsKey, getAsLong
	 * returns the AndroidCalendarId for this event. 
	 * @return the AndroidCalendarId for this event 
	 */ 
	public long getAndroidCalendarId() { 
		long Result = -1;
		if (this.ContentValues.containsKey(Events.CALENDAR_ID))
			Result = this.ContentValues.getAsLong(Events.CALENDAR_ID);
		return Result;
	} 
 
	/** 
	 * returns the UID for this event. you can also check, whether the UID was stored from server. the V1.7 release and before didn't save them. 
	 * example: UID:e6be67c6-eff0-44f8-a1a0-6c2cb1029944-caldavsyncadapter 
	 * @return the UID for this event 
	 */ 
	public String getUID() {
		String Result = "";
		if (this.ContentValues.containsKey(UID))
			Result = this.ContentValues.getAsString(UID);
		 
6
CodeRank
This code example shows how to use the following methods:getAsLong
    private static String buildChildKey(NamedContentValues child) {
        return child.uri.toString() + child.values.getAsString(BaseColumns._ID);
    } 
 
    private static String getSelectIdClause(ContentValues values) {
        return BaseColumns._ID + "=" + values.getAsLong(BaseColumns._ID);
    } 
 
    private static HashMap<String, NamedContentValues> buildChildrenMap(Entity entity) {
        final ArrayList<NamedContentValues> children = entity.getSubValues();
        final HashMap<String, NamedContentValues> childrenMap = new HashMap<String, NamedContentValues>(
                children.size());
        for (NamedContentValues child : children) {
            final String key = buildChildKey(child);
            childrenMap.put(key, child);
        } 
        return childrenMap;
    } 
} 
6
CodeRank

Related ContentValues getAsLong Questions & Answers:

getAsLong Method Overview
Gets a value and converts it to a Long.
See Code Examples for other Android ContentValues Methods: