Example usage for android.content ContentValues getAsLong

List of usage examples for android.content ContentValues getAsLong

Introduction

In this page you can find the example usage for android.content ContentValues getAsLong.

Prototype

public Long getAsLong(String key) 

Source Link

Document

Gets a value and converts it to a Long.

Usage

From source file:com.wheelly.activity.FilterDialog.java

private void updateLocationFromFilter(ContentValues filter, final Cursor locationCursor) {
    long locationId = filter.containsKey(F.LOCATION) ? filter.getAsLong(F.LOCATION) : 0;
    if (locationId > 0 && Utils.moveCursor(locationCursor, BaseColumns._ID, locationId) != -1) {
        final ContentValues location = LocationBroker.deserialize(locationCursor);
        c.location.setText(location != null ? location.getAsString("name") : filterValueNotFound);
    } else {/*  www .jav a  2s  . c  om*/
        c.location.setText(R.string.no_filter);
    }
}

From source file:org.runnerup.export.EndomondoSynchronizer.java

@Override
public void init(ContentValues config) {
    id = config.getAsLong("_id");
    String auth = config.getAsString(DB.ACCOUNT.AUTH_CONFIG);
    if (auth != null) {
        try {//from  w w  w.  j  av  a2  s.co  m
            JSONObject tmp = new JSONObject(auth);
            username = tmp.optString("username", null);
            password = tmp.optString("password", null);
            deviceId = tmp.optString("deviceId", null);
            authToken = tmp.optString("authToken", null);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.ultramegasoft.flavordex2.EntryListActivity.java

/**
 * Open the entry list with search results.
 *
 * @param filters   The filter values//from  w ww  .j  a v a  2 s .c  o  m
 * @param where     The where clause
 * @param whereArgs The values for the parameters of the where clause
 */
public void onSearchSubmitted(@NonNull ContentValues filters, @NonNull String where,
        @NonNull String[] whereArgs) {
    mFilters = filters;
    final long catId = filters.getAsLong(Tables.Entries.CAT_ID);
    final Fragment fragment = EntryListFragment.getInstance(catId, mTwoPane, mSelectedItem, false, where,
            whereArgs);
    getSupportFragmentManager().beginTransaction().replace(R.id.entry_list, fragment).commit();
}

From source file:com.partypoker.poker.engagement.reach.EngagementReachContent.java

/**
 * Parse a campaign./* w  ww  .j a  v a 2  s. c  om*/
 * @param campaignId already parsed campaign id.
 * @param values content data.
 * @throws JSONException if payload parsing failure.
 */
EngagementReachContent(com.microsoft.azure.engagement.reach.CampaignId campaignId, ContentValues values)
        throws JSONException {
    /* Parse base fields */
    mCampaignId = campaignId;
    mDlc = values.getAsInteger(DLC);
    mDlcId = values.getAsString(DLC_ID);
    mCategory = values.getAsString(CATEGORY);
    Long expiry = values.getAsLong(TTL);
    if (expiry != null) {
        expiry *= 1000L;
        if (parseBoolean(values, USER_TIME_ZONE))
            expiry -= TimeZone.getDefault().getOffset(expiry);
    }
    mExpiry = expiry;
    if (values.containsKey(PAYLOAD))
        setPayload(new JSONObject(values.getAsString(PAYLOAD)));
}

From source file:com.partypoker.poker.engagement.reach.EngagementReachInteractiveContent.java

@Override
void setState(ContentValues values) {
    super.setState(values);
    this.mNotificationActioned = parseBoolean(values, NOTIFICATION_ACTIONED);
    this.mNotificationFirstDisplayedDate = values.getAsLong(NOTIFICATION_FIRST_DISPLAYED_DATE);
    this.mNotificationLastDisplayedDate = values.getAsLong(NOTIFICATION_LAST_DISPLAYED_DATE);
    this.mContentDisplayed = parseBoolean(values, CONTENT_DISPLAYED);
}

From source file:org.runnerup.export.RunKeeperUploader.java

@Override
public void init(ContentValues config) {
    String authConfig = config.getAsString(DB.ACCOUNT.AUTH_CONFIG);
    id = config.getAsLong("_id");
    if (authConfig != null) {
        try {//from w  w  w.  j a  v  a 2s.  c o  m
            JSONObject tmp = new JSONObject(authConfig);
            access_token = tmp.optString("access_token", null);
            feed_access_token = tmp.optString("feed_access_token", null);
            if (feed_access_token == null) {
                feed_username = tmp.optString("username", null);
                feed_password = tmp.optString("password", null);
            } else {
                feed_username = null;
                feed_password = null;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

From source file:org.runnerup.export.FunBeatSynchronizer.java

@Override
public void init(ContentValues config) {
    id = config.getAsLong("_id");
    String authToken = config.getAsString(DB.ACCOUNT.AUTH_CONFIG);
    if (authToken != null) {
        try {/*from  w w  w.  j  a v  a 2  s  .c o m*/
            JSONObject tmp = new JSONObject(authToken);
            username = tmp.optString("username", null);
            password = tmp.optString("password", null);
            loginID = tmp.optString("loginID", null);
            loginSecretHashed = tmp.optString("loginSecretHashed", null);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}

From source file:org.runnerup.export.RunningAHEADSynchronizer.java

@Override
public void init(ContentValues config) {
    String authConfig = config.getAsString(DB.ACCOUNT.AUTH_CONFIG);
    if (authConfig != null) {
        try {/*from  ww  w  .j  av  a2  s.  c om*/
            JSONObject tmp = new JSONObject(authConfig);
            access_token = tmp.optString("access_token", null);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    id = config.getAsLong("_id");
}

From source file:app.com.example.wungmathing.sunshine.FetchWeatherTask.java

String[] convertContentValuesToUXFormat(Vector<ContentValues> cvv) {
    // return strings to keep UI functional for now
    String[] resultStrs = new String[cvv.size()];
    for (int i = 0; i < cvv.size(); i++) {
        ContentValues weatherValues = cvv.elementAt(i);
        String highAndLow = formatHighLows(weatherValues.getAsDouble(WeatherEntry.COLUMN_MAX_TEMP),
                weatherValues.getAsDouble(WeatherEntry.COLUMN_MIN_TEMP));
        resultStrs[i] = getReadableDateString(weatherValues.getAsLong(WeatherEntry.COLUMN_DATE)) + " - "
                + weatherValues.getAsString(WeatherEntry.COLUMN_SHORT_DESC) + " - " + highAndLow;
    }// w  w w.  j  a  v a2  s .  c o  m
    return resultStrs;
}

From source file:org.runnerup.export.GarminSynchronizer.java

@Override
public void init(ContentValues config) {
    id = config.getAsLong("_id");
    String authToken = config.getAsString(DB.ACCOUNT.AUTH_CONFIG);
    if (authToken != null) {
        try {//from  w w w  .j av a2 s  . c om
            JSONObject tmp = new JSONObject(authToken);
            username = tmp.optString("username", null);
            password = tmp.optString("password", null);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}