Example usage for android.database Cursor getDouble

List of usage examples for android.database Cursor getDouble

Introduction

In this page you can find the example usage for android.database Cursor getDouble.

Prototype

double getDouble(int columnIndex);

Source Link

Document

Returns the value of the requested column as a double.

Usage

From source file:com.ichi2.anki.SyncClient.java

private JSONArray getFact(Long id) {
    JSONArray fact = new JSONArray();

    // TODO: Take into account the updateModified boolean (modified = time.time() or modified = "modified"... what
    // does exactly do that?)
    Cursor cursor = AnkiDatabaseManager.getDatabase(mDeck.getDeckPath()).getDatabase().rawQuery(
            "SELECT id, modelId, created, modified, tags, spaceUntil, lastCardId FROM facts WHERE id = " + id,
            null);//  w w w.j a va  2 s .c o m
    if (cursor.moveToFirst()) {
        try {
            fact.put(cursor.getLong(0));
            fact.put(cursor.getLong(1));
            fact.put(cursor.getDouble(2));
            fact.put(cursor.getDouble(3));
            fact.put(cursor.getString(4));
            fact.put(cursor.getDouble(5));
            fact.put(cursor.getLong(6));
        } catch (JSONException e) {
            Log.i(AnkiDroidApp.TAG, "JSONException = " + e.getMessage());
        }
    }
    cursor.close();

    return fact;
}

From source file:com.example.barni.sunshine.DetailFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null && data.moveToFirst()) {
        ViewParent vp = getView().getParent();
        if (vp instanceof CardView) {
            ((View) vp).setVisibility(View.VISIBLE);
        }/*from ww  w . j ava  2  s.  c  om*/

        // Read weather condition ID from cursor
        int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);

        if (Utility.usingLocalGraphics(getActivity())) {
            mIconView.setImageResource(Utility.getArtResourceForWeatherCondition(weatherId));
        } else {
            // Use weather art image
            Glide.with(this).load(Utility.getArtUrlForWeatherCondition(getActivity(), weatherId))
                    .error(Utility.getArtResourceForWeatherCondition(weatherId)).crossFade().into(mIconView);
        }

        // Read date from cursor and update views for day of week and date
        long date = data.getLong(COL_WEATHER_DATE);
        String dateText = Utility.getFullFriendlyDayString(getActivity(), date);
        mDateView.setText(dateText);

        // Get description from weather condition ID
        String description = Utility.getStringForWeatherCondition(getActivity(), weatherId);
        mDescriptionView.setText(description);
        mDescriptionView.setContentDescription(getString(R.string.a11y_forecast, description));

        // For accessibility, add a content description to the icon field. Because the ImageView
        // is independently focusable, it's better to have a description of the image. Using
        // null is appropriate when the image is purely decorative or when the image already
        // has text describing it in the same UI component.
        mIconView.setContentDescription(getString(R.string.a11y_forecast_icon, description));

        // Read high temperature from cursor and update view
        boolean isMetric = Utility.isMetric(getActivity());

        double high = data.getDouble(COL_WEATHER_MAX_TEMP);
        String highString = Utility.formatTemperature(getActivity(), high);
        mHighTempView.setText(highString);
        mHighTempView.setContentDescription(getString(R.string.a11y_high_temp, highString));

        // Read low temperature from cursor and update view
        double low = data.getDouble(COL_WEATHER_MIN_TEMP);
        String lowString = Utility.formatTemperature(getActivity(), low);
        mLowTempView.setText(lowString);
        mLowTempView.setContentDescription(getString(R.string.a11y_low_temp, lowString));

        // Read humidity from cursor and update view
        float humidity = data.getFloat(COL_WEATHER_HUMIDITY);
        mHumidityView.setText(getActivity().getString(R.string.format_humidity, humidity));
        mHumidityView.setContentDescription(getString(R.string.a11y_humidity, mHumidityView.getText()));
        mHumidityLabelView.setContentDescription(mHumidityView.getContentDescription());

        // Read wind speed and direction from cursor and update view
        float windSpeedStr = data.getFloat(COL_WEATHER_WIND_SPEED);
        float windDirStr = data.getFloat(COL_WEATHER_DEGREES);
        mWindView.setText(Utility.getFormattedWind(getActivity(), windSpeedStr, windDirStr));
        mWindView.setContentDescription(getString(R.string.a11y_wind, mWindView.getText()));
        mWindLabelView.setContentDescription(mWindView.getContentDescription());

        // Read pressure from cursor and update view
        float pressure = data.getFloat(COL_WEATHER_PRESSURE);
        mPressureView.setText(getString(R.string.format_pressure, pressure));
        mPressureView.setContentDescription(getString(R.string.a11y_pressure, mPressureView.getText()));
        mPressureLabelView.setContentDescription(mPressureView.getContentDescription());

        // We still need this for the share intent
        mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);

    }
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar);

    // We need to start the enter transition after the data has loaded
    if (activity instanceof DetailActivity) {
        activity.supportStartPostponedEnterTransition();

        if (null != toolbarView) {
            activity.setSupportActionBar(toolbarView);

            activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
            activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    } else {
        if (null != toolbarView) {
            Menu menu = toolbarView.getMenu();
            if (null != menu)
                menu.clear();
            toolbarView.inflateMenu(R.menu.detailfragment);
            finishCreatingMenu(toolbarView.getMenu());
        }
    }
}

From source file:com.example.weather.DetailFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null && data.moveToFirst()) {
        ViewParent vp = getView().getParent();
        if (vp instanceof CardView) {
            ((View) vp).setVisibility(View.VISIBLE);
        }//from  www.j a va 2 s .  co m

        // Read weather condition ID from cursor
        int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);

        if (Utility.usingLocalGraphics(getActivity())) {
            mIconView.setImageResource(Utility.getArtResourceForWeatherCondition(weatherId));
        } else {
            // Use weather art image
            Glide.with(this).load(Utility.getArtUrlForWeatherCondition(getActivity(), weatherId))
                    .error(Utility.getArtResourceForWeatherCondition(weatherId)).crossFade().into(mIconView);
        }

        // Read date from cursor and update views for day of week and date
        long date = data.getLong(COL_WEATHER_DATE);
        String dateText = Utility.getFullFriendlyDayString(getActivity(), date);
        mDateView.setText(dateText);

        // Get description from weather condition ID
        String description = Utility.getStringForWeatherCondition(getActivity(), weatherId);
        mDescriptionView.setText(description);
        mDescriptionView.setContentDescription(getString(R.string.a11y_forecast, description));

        // For accessibility, add a content description to the icon field. Because the ImageView
        // is independently focusable, it's better to have a description of the image. Using
        // null is appropriate when the image is purely decorative or when the image already
        // has text describing it in the same UI component.
        mIconView.setContentDescription(getString(R.string.a11y_forecast_icon, description));

        // Read high temperature from cursor and update view
        boolean isMetric = Utility.isMetric(getActivity());

        double high = data.getDouble(COL_WEATHER_MAX_TEMP);
        String highString = Utility.formatTemperature(getActivity(), high);
        mHighTempView.setText(highString);
        mHighTempView.setContentDescription(getString(R.string.a11y_high_temp, highString));

        // Read low temperature from cursor and update view
        double low = data.getDouble(COL_WEATHER_MIN_TEMP);
        String lowString = Utility.formatTemperature(getActivity(), low);
        mLowTempView.setText(lowString);
        mLowTempView.setContentDescription(getString(R.string.a11y_low_temp, lowString));

        // Read humidity from cursor and update view
        float humidity = data.getFloat(COL_WEATHER_HUMIDITY);
        mHumidityView.setText(getActivity().getString(R.string.format_humidity, humidity));
        mHumidityView.setContentDescription(getString(R.string.a11y_humidity, mHumidityView.getText()));
        mHumidityLabelView.setContentDescription(mHumidityView.getContentDescription());

        // Read wind speed and direction from cursor and update view
        float windSpeedStr = data.getFloat(COL_WEATHER_WIND_SPEED);
        float windDirStr = data.getFloat(COL_WEATHER_DEGREES);
        mWindView.setText(Utility.getFormattedWind(getActivity(), windSpeedStr, windDirStr));
        mWindView.setContentDescription(getString(R.string.a11y_wind, mWindView.getText()));
        mWindLabelView.setContentDescription(mWindView.getContentDescription());

        // Read pressure from cursor and update view
        float pressure = data.getFloat(COL_WEATHER_PRESSURE);
        mPressureView.setText(getString(R.string.format_pressure, pressure));
        mPressureView.setContentDescription(getString(R.string.a11y_pressure, mPressureView.getText()));
        mPressureLabelView.setContentDescription(mPressureView.getContentDescription());

        // We still need this for the share intent
        mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);

    }
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar);

    // We need to start the enter transition after the data has loaded
    if (mTransitionAnimation) {

        activity.supportStartPostponedEnterTransition();

        if (null != toolbarView) {
            activity.setSupportActionBar(toolbarView);
            activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
            activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    } else {
        if (null != toolbarView) {
            Menu menu = toolbarView.getMenu();
            if (null != menu)
                menu.clear();
            toolbarView.inflateMenu(R.menu.detailfragment);
            finishCreatingMenu(toolbarView.getMenu());
        }
    }
}

From source file:com.appniche.android.sunshine.app.DetailFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null && data.moveToFirst()) {
        ViewParent vp = getView().getParent();
        if (vp instanceof CardView) {
            ((View) vp).setVisibility(View.VISIBLE);
        }//from  w  w  w.j  a v  a  2  s. c  o  m

        // Read weather condition ID from cursor
        int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);

        if (Utility.usingLocalGraphics(getActivity())) {
            mIconView.setImageResource(Utility.getArtResourceForWeatherCondition(weatherId));
        } else {
            // Use weather art image
            Glide.with(this).load(Utility.getArtUrlForWeatherCondition(getActivity(), weatherId))
                    .error(Utility.getArtResourceForWeatherCondition(weatherId)).crossFade().into(mIconView);
        }

        // Read date from cursor and update views for day of week and date
        long date = data.getLong(COL_WEATHER_DATE);
        String dateText = Utility.getFullFriendlyDayString(getActivity(), date);
        mDateView.setText(dateText);

        // Get description from weather condition ID
        String description = Utility.getStringForWeatherCondition(getActivity(), weatherId);
        mDescriptionView.setText(description);
        mDescriptionView.setContentDescription(getString(R.string.a11y_forecast, description));

        // For accessibility, add a content description to the icon field. Because the ImageView
        // is independently focusable, it's better to have a description of the image. Using
        // null is appropriate when the image is purely decorative or when the image already
        // has text describing it in the same UI component.
        mIconView.setContentDescription(getString(R.string.a11y_forecast_icon, description));

        // Read high temperature from cursor and update view
        boolean isMetric = Utility.isMetric(getActivity());

        double high = data.getDouble(COL_WEATHER_MAX_TEMP);
        String highString = Utility.formatTemperature(getActivity(), high);
        mHighTempView.setText(highString);
        mHighTempView.setContentDescription(getString(R.string.a11y_high_temp, highString));

        // Read low temperature from cursor and update view
        double low = data.getDouble(COL_WEATHER_MIN_TEMP);
        String lowString = Utility.formatTemperature(getActivity(), low);
        mLowTempView.setText(lowString);
        mLowTempView.setContentDescription(getString(R.string.a11y_low_temp, lowString));

        // Read humidity from cursor and update view
        float humidity = data.getFloat(COL_WEATHER_HUMIDITY);
        mHumidityView.setText(getActivity().getString(R.string.format_humidity, humidity));
        mHumidityView.setContentDescription(getString(R.string.a11y_humidity, mHumidityView.getText()));
        mHumidityLabelView.setContentDescription(mHumidityView.getContentDescription());

        // Read wind speed and direction from cursor and update view
        float windSpeedStr = data.getFloat(COL_WEATHER_WIND_SPEED);
        float windDirStr = data.getFloat(COL_WEATHER_DEGREES);
        mWindView.setText(Utility.getFormattedWind(getActivity(), windSpeedStr, windDirStr));
        mWindView.setContentDescription(getString(R.string.a11y_wind, mWindView.getText()));
        mWindLabelView.setContentDescription(mWindView.getContentDescription());

        // Read pressure from cursor and update view
        float pressure = data.getFloat(COL_WEATHER_PRESSURE);
        mPressureView.setText(getString(R.string.format_pressure, pressure));
        mPressureView.setContentDescription(getString(R.string.a11y_pressure, mPressureView.getText()));
        mPressureLabelView.setContentDescription(mPressureView.getContentDescription());

        // We still need this for the share intent
        mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);

    }
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar);

    // We need to start the enter transition after the data has loaded
    if (mTransitionAnimation) {
        activity.supportStartPostponedEnterTransition();

        if (null != toolbarView) {
            activity.setSupportActionBar(toolbarView);

            activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
            activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    } else {
        if (null != toolbarView) {
            Menu menu = toolbarView.getMenu();
            if (null != menu)
                menu.clear();
            toolbarView.inflateMenu(R.menu.detailfragment);
            finishCreatingMenu(toolbarView.getMenu());
        }
    }
}

From source file:com.mobile.system.db.abatis.AbatisService.java

public Object parseToObject(Class beanClass, Cursor cur)
        throws IllegalAccessException, InstantiationException, SecurityException, NoSuchMethodException {
    Object obj = null;/* ww  w  .  j a v  a  2 s .  c o  m*/
    Field[] props = beanClass.getDeclaredFields();
    if (props == null || props.length == 0) {
        Log.d(TAG, "Class" + beanClass.getName() + " has no fields");
        return null;
    }
    // Create instance of this Bean class
    obj = beanClass.newInstance();
    // Set value of each member variable of this object
    for (int i = 0; i < props.length; i++) {
        String fieldName = props[i].getName();
        if (props[i].getModifiers() == (Modifier.PUBLIC | Modifier.STATIC)) {
            continue;
        }

        Class type = props[i].getType();
        String typeName = type.getName();
        // Check for Custom type

        Class[] parms = { type };
        Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
        m.setAccessible(true);
        // Set value
        try {
            int curIdx = cur.getColumnIndex(fieldName);
            if (curIdx != -1) {
                int nDotIdx = typeName.lastIndexOf(".");
                if (nDotIdx >= 0) {
                    typeName = typeName.substring(nDotIdx);
                }

                if (typeName.equals("int")) {
                    m.invoke(obj, cur.getInt(curIdx));
                } else if (typeName.equals("double")) {
                    m.invoke(obj, cur.getDouble(curIdx));
                } else if (typeName.equals("String")) {
                    m.invoke(obj, cur.getString(curIdx));
                } else if (typeName.equals("long")) {
                    m.invoke(obj, cur.getLong(curIdx));
                } else if (typeName.equals("float")) {
                    m.invoke(obj, cur.getFloat(curIdx));
                } else if (typeName.equals("Date")) {
                    m.invoke(obj, cur.getString(curIdx));
                } else if (typeName.equals("byte[]") || typeName.equals("[B")) {
                    m.invoke(obj, cur.getBlob(curIdx));
                } else {
                    m.invoke(obj, cur.getString(curIdx));
                }
            }

        } catch (Exception ex) {
            Log.d(TAG, ex.getMessage());
        }
    }
    return obj;
}

From source file:com.ichi2.anki.SyncClient.java

private JSONArray bundleSources() {
    JSONArray bundledSources = new JSONArray();

    Cursor cursor = AnkiDatabaseManager.getDatabase(mDeck.getDeckPath()).getDatabase()
            .rawQuery("SELECT * FROM sources", null);
    while (cursor.moveToNext()) {
        try {/*from www  .  j a v a2s.  c  o m*/
            JSONArray source = new JSONArray();

            // id
            source.put(cursor.getLong(0));
            // name
            source.put(cursor.getString(1));
            // created
            source.put(cursor.getDouble(2));
            // lastSync
            source.put(cursor.getDouble(3));
            // syncPeriod
            source.put(cursor.getInt(4));

            bundledSources.put(source);
        } catch (JSONException e) {
            Log.i(AnkiDroidApp.TAG, "JSONException = " + e.getMessage());
        }
    }
    cursor.close();

    Log.i(AnkiDroidApp.TAG, "Bundled sources = " + bundledSources);
    return bundledSources;
}

From source file:com.example.bryan.sunshine.app.DetailFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null && data.moveToFirst()) {
        ViewParent vp = getView().getParent();
        if (vp instanceof CardView) {
            ((View) vp).setVisibility(View.VISIBLE);
        }/*  www . j  av a2 s. co m*/

        // Read weather condition ID from cursor
        int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);

        if (Utility.usingLocalGraphics(getActivity())) {
            mIconView.setImageResource(WeatherIconUtility.getArtResourceForWeatherCondition(weatherId));
        } else {
            // Use weather art image
            Glide.with(this).load(Utility.getArtUrlForWeatherCondition(getActivity(), weatherId))
                    .error(WeatherIconUtility.getArtResourceForWeatherCondition(weatherId)).crossFade()
                    .into(mIconView);
        }

        // Read date from cursor and update views for day of week and date
        long date = data.getLong(COL_WEATHER_DATE);
        String dateText = Utility.getFullFriendlyDayString(getActivity(), date);
        mDateView.setText(dateText);

        // Get description from weather condition ID
        String description = Utility.getStringForWeatherCondition(getActivity(), weatherId);
        mDescriptionView.setText(description);
        mDescriptionView.setContentDescription(getString(R.string.a11y_forecast, description));

        // For accessibility, add a content description to the icon field. Because the ImageView
        // is independently focusable, it's better to have a description of the image. Using
        // null is appropriate when the image is purely decorative or when the image already
        // has text describing it in the same UI component.
        mIconView.setContentDescription(getString(R.string.a11y_forecast_icon, description));

        // Read high temperature from cursor and update view
        boolean isMetric = Utility.isMetric(getActivity());

        double high = data.getDouble(COL_WEATHER_MAX_TEMP);
        String highString = Utility.formatTemperature(getActivity(), high);
        mHighTempView.setText(highString);
        mHighTempView.setContentDescription(getString(R.string.a11y_high_temp, highString));

        // Read low temperature from cursor and update view
        double low = data.getDouble(COL_WEATHER_MIN_TEMP);
        String lowString = Utility.formatTemperature(getActivity(), low);
        mLowTempView.setText(lowString);
        mLowTempView.setContentDescription(getString(R.string.a11y_low_temp, lowString));

        // Read humidity from cursor and update view
        float humidity = data.getFloat(COL_WEATHER_HUMIDITY);
        mHumidityView.setText(getActivity().getString(R.string.format_humidity, humidity));
        mHumidityView.setContentDescription(getString(R.string.a11y_humidity, mHumidityView.getText()));
        mHumidityLabelView.setContentDescription(mHumidityView.getContentDescription());

        // Read wind speed and direction from cursor and update view
        float windSpeedStr = data.getFloat(COL_WEATHER_WIND_SPEED);
        float windDirStr = data.getFloat(COL_WEATHER_DEGREES);
        mWindView.setText(Utility.getFormattedWind(getActivity(), windSpeedStr, windDirStr));
        mWindView.setContentDescription(getString(R.string.a11y_wind, mWindView.getText()));
        mWindLabelView.setContentDescription(mWindView.getContentDescription());

        // Read pressure from cursor and update view
        float pressure = data.getFloat(COL_WEATHER_PRESSURE);
        mPressureView.setText(getString(R.string.format_pressure, pressure));
        mPressureView.setContentDescription(getString(R.string.a11y_pressure, mPressureView.getText()));
        mPressureLabelView.setContentDescription(mPressureView.getContentDescription());

        // We still need this for the share intent
        mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);

    }
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar);

    // We need to start the enter transition after the data has loaded
    if (mTransitionAnimation) {
        activity.supportStartPostponedEnterTransition();

        if (null != toolbarView) {
            activity.setSupportActionBar(toolbarView);

            activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
            activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    } else {
        if (null != toolbarView) {
            Menu menu = toolbarView.getMenu();
            if (null != menu)
                menu.clear();
            toolbarView.inflateMenu(R.menu.detailfragment);
            finishCreatingMenu(toolbarView.getMenu());
        }
    }
}

From source file:mx.com.adolfogarcia.popularmovies.model.view.MovieDetailViewModel.java

/**
 * Retrieves the data from the cursor passed as argument and sets it onto the
 * {@link MovieDetailViewModel}'s current {@link Movie}. The projection used
 * must be {@link MovieDetailQuery#PROJECTION}. This method
 * also notifies the data binding of the change, so the visual elements can
 * be updated./*from  ww  w.  j a v  a  2 s. com*/
 *
 * @param cursor the {@link Cursor} containing the data  to load.
 * @throws IllegalStateException if there is no {@link Movie} currently set
 *     in the {@link MovieDetailViewModel}.
 * @throws IllegalArgumentException if the data passed does not belong to
 *     the {@link Movie} currently set (i.e. does not have the same id).
 */
public void setMovieData(Cursor cursor) {
    if (mMovie == null) {
        throw new IllegalStateException("No movie currently set in MovieDetailViewModel.");
    }
    if (cursor == null) {
        return;
    }
    if (!cursor.moveToFirst()) {
        Log.w(LOG_TAG, "The cursor contains no data. Ignoring movie details.");
        return;
    }
    if (mMovie.getId() != cursor.getLong(MovieDetailQuery.COL_ID)) {
        throw new IllegalArgumentException("The data passed does not belong to the movie");
    }
    requireNonNullContext();
    requireNonNullConfiguration();
    RestfulServiceConfiguration configuration = mWeakConfiguration.get();
    Context context = mWeakContext.get();
    mMovie.setApiId(cursor.getLong(MovieDetailQuery.COL_API_ID));
    mMovie.setOriginalTitle(cursor.getString(MovieDetailQuery.COL_ORIGINAL_TITLE));
    mMovie.setReleaseDate(cursor.getLong(MovieDetailQuery.COL_RELEASE_DATE));
    mMovie.setOverview(cursor.getString(MovieDetailQuery.COL_OVERVIEW));
    int posterPixelWidth = context.getResources().getDimensionPixelSize(R.dimen.movie_poster_thumbnail_width);
    mMovie.setPosterUri(Uri.parse(configuration
            .getBestFittingPosterUrl(cursor.getString(MovieDetailQuery.COL_POSTER_PATH), posterPixelWidth)));
    int backdropPixelWidth = context.getResources().getDimensionPixelSize(R.dimen.movie_backdrop_width);
    mMovie.setBackdropUri(Uri.parse(configuration.getBestFittingPosterUrl(
            cursor.getString(MovieDetailQuery.COL_BACKDROP_PATH), backdropPixelWidth)));
    mMovie.setVoteAverage(cursor.getDouble(MovieDetailQuery.COL_VOTE_AVERAGE));
    mMovie.setUserFavorite(BooleanUtils.toBoolean(cursor.getInt(MovieDetailQuery.COL_USER_FAVORITE)));

    notifyPropertyChanged(BR._all);
}

From source file:org.globalquakemodel.org.idctdo.EQForm_MapView.java

private void loadPrevSurveyPoints() {
    if (DEBUG_LOG)
        Log.d(TAG, "loading PREVIOUS survey points");
    mDbHelper = new GemDbAdapter(getBaseContext());
    mDbHelper.createDatabase();/* ww  w .  jav a 2s .  c o m*/
    mDbHelper.open();
    Cursor mCursor = mDbHelper.getGemObjectsForMap();
    mDbHelper.close();

    //if (DEBUG_LOG) Log.d("IDCT","Gem Map Objects cursor " + DatabaseUtils.dumpCursorToString(mCursor));
    //ArrayList<DBRecord> gemObjectsList = GemUtilities.cursorToArrayList(gemObjects);
    //Log.d("IDCT","Gem Map Objects List " + gemObjectsList.get(gemObjectsList.size()-1));
    mCursor.moveToFirst();

    mWebView.loadUrl("javascript:clearMySurveyPoints()");//Inefficient   

    while (!mCursor.isAfterLast()) {
        //if (DEBUG_LOG) Log.d("IDCT","Gem Map Objects cursor " + mCursor.getDouble(1) + " , " + mCursor.getDouble(2) + " , " + mCursor.getString(0));

        mWebView.loadUrl("javascript:loadSurveyPointsOnMap(" + mCursor.getDouble(1) + "," + mCursor.getDouble(2)
                + ", \"" + mCursor.getString(0) + "\")");
        mCursor.moveToNext();
    }
    mCursor.close();

}

From source file:org.digitalcampus.oppia.application.DbHelper.java

public Course getCourse(long courseId, long userId) {
    Course course = null;/*from  w  w w.  j a v a  2  s . c o  m*/
    String s = COURSE_C_ID + "=?";
    String[] args = new String[] { String.valueOf(courseId) };
    Cursor c = db.query(COURSE_TABLE, null, s, args, null, null, null);
    c.moveToFirst();
    while (c.isAfterLast() == false) {
        course = new Course(prefs.getString(PrefsActivity.PREF_STORAGE_LOCATION, ""));
        course.setCourseId(c.getInt(c.getColumnIndex(COURSE_C_ID)));
        course.setVersionId(c.getDouble(c.getColumnIndex(COURSE_C_VERSIONID)));
        course.setTitlesFromJSONString(c.getString(c.getColumnIndex(COURSE_C_TITLE)));
        course.setImageFile(c.getString(c.getColumnIndex(COURSE_C_IMAGE)));
        course.setLangsFromJSONString(c.getString(c.getColumnIndex(COURSE_C_LANGS)));
        course.setShortname(c.getString(c.getColumnIndex(COURSE_C_SHORTNAME)));
        course.setPriority(c.getInt(c.getColumnIndex(COURSE_C_ORDER_PRIORITY)));
        course.setDescriptionsFromJSONString(c.getString(c.getColumnIndex(COURSE_C_DESC)));
        course = this.courseSetProgress(course, userId);
        c.moveToNext();
    }
    c.close();
    return course;
}