List of usage examples for android.content ContentValues getAsString
public String getAsString(String key)
From source file:com.concentricsky.android.khanacademy.data.remote.LibraryUpdaterTask.java
private ChildArrayResults parseChildArray(JsonParser parser, SQLiteDatabase tempDb, String parentTopic_id) throws JsonParseException, IOException { ChildArrayResults result = new ChildArrayResults(); int seq = 0;//from www . java 2s. c om JsonToken currentToken = parser.getCurrentToken(); if (currentToken == JsonToken.START_ARRAY) { while (parser.nextValue() == JsonToken.START_OBJECT) { // Otherwise, we will be at END_ARRAY here. ContentValues values = parseObject(parser, tempDb, parentTopic_id, seq++); if (values != null && values.containsKey("kind")) { String kind = values.getAsString("kind"); if ("Topic".equals(kind) && values.containsKey("_id")) { result.childKind = kind; result.childIds.add(values.getAsString("_id")); result.videoCount += values.getAsInteger("video_count"); if (result.thumbId == null && values.containsKey("thumb_id")) { // Return the first available thumb id as this topic's thumb id. result.thumbId = values.getAsString("thumb_id"); } } else if ("Video".equals(kind) && values.containsKey("readable_id")) { result.childKind = kind; result.childIds.add(values.getAsString("readable_id")); result.videoCount += 1; if (result.thumbId == null && values.containsKey("pngurl")) { // Return youtube_id of first video with a thumbnail as this topic's thumbnail id. result.thumbId = values.getAsString("youtube_id"); } } } } } return result; }
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 ww w .j av a 2s . c om*/ 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:p1.nd.khan.jubair.mohammadd.popularmovies.adapter.MovieDetailsAdapter.java
/** * Method to check if movie is favorite. * * @param movieId to check.//w w w . ja v a 2 s. c o m * @return movie title after addition else null */ private String addToFavorites(int movieId) { String title = null; String[] projection = new String[] { "*" }; String selection = MovieEntry.C_MOVIE_ID + "=?"; String[] selectionArgs = { String.valueOf(movieId) }; ContentResolver contentResolver = mContext.getContentResolver(); Cursor cMovies = null; Cursor cTrailers = null; Cursor cReviews = null; try { cMovies = contentResolver.query(MovieEntry.CONTENT_URI, projection, selection, selectionArgs, null); if (null != cMovies && cMovies.moveToFirst()) { ContentValues contentValues = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cMovies, contentValues); contentValues.remove("_id"); title = contentValues.getAsString(MovieEntry.C_ORIGINAL_TITLE); contentResolver.insert(MovieEntry.FAVORITES_CONTENT_URI, contentValues); } cTrailers = contentResolver.query(TrailersEntry.CONTENT_URI, projection, selection, selectionArgs, null); while (null != cTrailers && cTrailers.moveToNext()) { ContentValues contentValues = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cTrailers, contentValues); contentValues.remove("_id"); contentResolver.insert(TrailersEntry.FAVORITES_CONTENT_URI, contentValues); } cReviews = contentResolver.query(ReviewsEntry.CONTENT_URI, projection, selection, selectionArgs, null); while (null != cReviews && cReviews.moveToNext()) { ContentValues contentValues = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cReviews, contentValues); contentValues.remove("_id"); contentResolver.insert(ReviewsEntry.FAVORITES_CONTENT_URI, contentValues); } } catch (SQLException e) { Log.e(LOG_TAG, "SQLException!"); } finally { if (null != cMovies) cMovies.close(); if (null != cTrailers) cTrailers.close(); if (null != cReviews) cReviews.close(); } return title; }
From source file:com.example.danstormont.sunshine.app.FetchWeatherTask.java
/** * Take the String representing the complete forecast in JSON Format and * pull out the data we need to construct the Strings needed for the wireframes. * * Fortunately parsing is easy: constructor takes the JSON string and converts it * into an Object hierarchy for us./* ww w . ja v a2 s . c om*/ */ private void getWeatherDataFromJson(String forecastJsonStr, int numDays, String locationSetting) throws JSONException { // These are the names of the JSON objects that need to be extracted. // Location information final String OWM_CITY = "city"; final String OWM_CITY_NAME = "name"; final String OWM_COORD = "coord"; final String OWM_COORD_LAT = "lat"; final String OWM_COORD_LONG = "lon"; // Weather information. Each day's forecast info is an element of the "list" array. final String OWM_LIST = "list"; final String OWM_DATETIME = "dt"; final String OWM_PRESSURE = "pressure"; final String OWM_HUMIDITY = "humidity"; final String OWM_WINDSPEED = "speed"; final String OWM_WIND_DIRECTION = "deg"; // All temperatures are children of the "temp" object. final String OWM_TEMPERATURE = "temp"; final String OWM_MAX = "max"; final String OWM_MIN = "min"; final String OWM_WEATHER = "weather"; final String OWM_DESCRIPTION = "main"; final String OWM_WEATHER_ID = "id"; JSONObject forecastJson = new JSONObject(forecastJsonStr); JSONArray weatherArray = forecastJson.getJSONArray(OWM_LIST); JSONObject cityJson = forecastJson.getJSONObject(OWM_CITY); String cityName = cityJson.getString(OWM_CITY_NAME); JSONObject coordJSON = cityJson.getJSONObject(OWM_COORD); double cityLatitude = coordJSON.getDouble(OWM_COORD_LAT); double cityLongitude = coordJSON.getDouble(OWM_COORD_LONG); Log.v(LOG_TAG, cityName + ", with coord: " + cityLatitude + " " + cityLongitude); // Insert the location into the database. long locationID = addLocation(locationSetting, cityName, cityLatitude, cityLongitude); // Get and insert the new weather information into the database Vector<ContentValues> cVVector = new Vector<ContentValues>(weatherArray.length()); for (int i = 0; i < weatherArray.length(); i++) { // These are the values that will be collected. long dateTime; double pressure; int humidity; double windSpeed; double windDirection; double high; double low; String description; int weatherId; // Get the JSON object representing the day JSONObject dayForecast = weatherArray.getJSONObject(i); // The date/time is returned as a long. We need to convert that // into something human-readable, since most people won't read "1400356800" as // "this saturday". dateTime = dayForecast.getLong(OWM_DATETIME); pressure = dayForecast.getDouble(OWM_PRESSURE); humidity = dayForecast.getInt(OWM_HUMIDITY); windSpeed = dayForecast.getDouble(OWM_WINDSPEED); windDirection = dayForecast.getDouble(OWM_WIND_DIRECTION); // Description is in a child array called "weather", which is 1 element long. // That element also contains a weather code. JSONObject weatherObject = dayForecast.getJSONArray(OWM_WEATHER).getJSONObject(0); description = weatherObject.getString(OWM_DESCRIPTION); weatherId = weatherObject.getInt(OWM_WEATHER_ID); // Temperatures are in a child object called "temp". Try not to name variables // "temp" when working with temperature. It confuses everybody. JSONObject temperatureObject = dayForecast.getJSONObject(OWM_TEMPERATURE); high = temperatureObject.getDouble(OWM_MAX); low = temperatureObject.getDouble(OWM_MIN); ContentValues weatherValues = new ContentValues(); weatherValues.put(WeatherEntry.COLUMN_LOC_KEY, locationID); weatherValues.put(WeatherEntry.COLUMN_DATETEXT, WeatherContract.getDbDateString(new Date(dateTime * 1000L))); weatherValues.put(WeatherEntry.COLUMN_HUMIDITY, humidity); weatherValues.put(WeatherEntry.COLUMN_PRESSURE, pressure); weatherValues.put(WeatherEntry.COLUMN_WIND_SPEED, windSpeed); weatherValues.put(WeatherEntry.COLUMN_DEGREES, windDirection); weatherValues.put(WeatherEntry.COLUMN_MAX_TEMP, high); weatherValues.put(WeatherEntry.COLUMN_MIN_TEMP, low); weatherValues.put(WeatherEntry.COLUMN_SHORT_DESC, description); weatherValues.put(WeatherEntry.COLUMN_WEATHER_ID, weatherId); cVVector.add(weatherValues); if (cVVector.size() > 0) { ContentValues[] cvArray = new ContentValues[cVVector.size()]; cVVector.toArray(cvArray); int rowsInserted = mContext.getContentResolver().bulkInsert(WeatherEntry.CONTENT_URI, cvArray); Log.v(LOG_TAG, "inserted " + rowsInserted + " rows of weather data"); } // Use a DEBUG variable to gate whether or not you do this, so you can easily // turn it on and off, and so that it's easy to see what you can rip out if // you ever want to remove it. if (DEBUG) { Cursor weatherCursor = mContext.getContentResolver().query(WeatherEntry.CONTENT_URI, null, null, null, null); if (weatherCursor.moveToFirst()) { ContentValues resultValues = new ContentValues(); DatabaseUtils.cursorRowToContentValues(weatherCursor, resultValues); Log.v(LOG_TAG, "Query succeeded! **********"); for (String key : resultValues.keySet()) { Log.v(LOG_TAG, key + ": " + resultValues.getAsString(key)); } } else { Log.v(LOG_TAG, "Query failed! :( **********"); } } } }
From source file:com.chen.mail.providers.Attachment.java
/** * Create an attachment from a {@link ContentValues} object. * The keys should be {@link UIProvider.AttachmentColumns}. *///w w w .j a v a 2 s. c o m public Attachment(ContentValues values) { name = values.getAsString(UIProvider.AttachmentColumns.NAME); size = values.getAsInteger(UIProvider.AttachmentColumns.SIZE); uri = parseOptionalUri(values.getAsString(UIProvider.AttachmentColumns.URI)); contentType = values.getAsString(UIProvider.AttachmentColumns.CONTENT_TYPE); state = values.getAsInteger(UIProvider.AttachmentColumns.STATE); destination = values.getAsInteger(UIProvider.AttachmentColumns.DESTINATION); downloadedSize = values.getAsInteger(UIProvider.AttachmentColumns.DOWNLOADED_SIZE); contentUri = parseOptionalUri(values.getAsString(UIProvider.AttachmentColumns.CONTENT_URI)); thumbnailUri = parseOptionalUri(values.getAsString(UIProvider.AttachmentColumns.THUMBNAIL_URI)); previewIntentUri = parseOptionalUri(values.getAsString(UIProvider.AttachmentColumns.PREVIEW_INTENT_URI)); providerData = values.getAsString(UIProvider.AttachmentColumns.PROVIDER_DATA); supportsDownloadAgain = values.getAsBoolean(UIProvider.AttachmentColumns.SUPPORTS_DOWNLOAD_AGAIN); type = values.getAsInteger(UIProvider.AttachmentColumns.TYPE); flags = values.getAsInteger(UIProvider.AttachmentColumns.FLAGS); }
From source file:org.runnerup.export.RunKeeperSynchronizer.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 . ja v a2 s. 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) { Log.e(Constants.LOG, e.getMessage()); } } }
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 {// ww w.ja v a2 s .co m JSONObject tmp = new JSONObject(authToken); username = tmp.optString("username", null); password = tmp.optString("password", null); } catch (JSONException e) { e.printStackTrace(); } } }
From source file:org.onebusaway.android.ui.ArrivalsListAdapterStyleB.java
@Override protected void initView(final View view, CombinedArrivalInfoStyleB combinedArrivalInfoStyleB) { final ArrivalInfo stopInfo = combinedArrivalInfoStyleB.getArrivalInfoList().get(0); final ObaArrivalInfo arrivalInfo = stopInfo.getInfo(); final Context context = getContext(); LayoutInflater inflater = LayoutInflater.from(context); TextView routeName = (TextView) view.findViewById(R.id.routeName); TextView destination = (TextView) view.findViewById(R.id.routeDestination); // TableLayout that we will fill with TableRows of arrival times TableLayout arrivalTimesLayout = (TableLayout) view.findViewById(R.id.arrivalTimeLayout); arrivalTimesLayout.removeAllViews(); Resources r = view.getResources(); ImageButton starBtn = (ImageButton) view.findViewById(R.id.route_star); starBtn.setColorFilter(r.getColor(R.color.theme_primary)); ImageButton mapImageBtn = (ImageButton) view.findViewById(R.id.mapImageBtn); mapImageBtn.setColorFilter(r.getColor(R.color.theme_primary)); ImageButton routeMoreInfo = (ImageButton) view.findViewById(R.id.route_more_info); routeMoreInfo.setColorFilter(r.getColor(R.color.switch_thumb_normal_material_dark)); starBtn.setImageResource(/*from w w w . j a v a 2s . c om*/ stopInfo.isRouteAndHeadsignFavorite() ? R.drawable.focus_star_on : R.drawable.focus_star_off); starBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Show dialog for setting route favorite RouteFavoriteDialogFragment dialog = new RouteFavoriteDialogFragment.Builder( stopInfo.getInfo().getRouteId(), stopInfo.getInfo().getHeadsign()) .setRouteShortName(stopInfo.getInfo().getShortName()) .setRouteLongName(stopInfo.getInfo().getRouteLongName()) .setStopId(stopInfo.getInfo().getStopId()) .setFavorite(!stopInfo.isRouteAndHeadsignFavorite()).build(); dialog.setCallback(new RouteFavoriteDialogFragment.Callback() { @Override public void onSelectionComplete(boolean savedFavorite) { if (savedFavorite) { mFragment.refreshLocal(); } } }); dialog.show(mFragment.getFragmentManager(), RouteFavoriteDialogFragment.TAG); } }); // Setup map mapImageBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFragment.showRouteOnMap(stopInfo); } }); // Setup more routeMoreInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFragment.showListItemMenu(view, stopInfo); } }); routeName.setText(arrivalInfo.getShortName()); destination.setText(MyTextUtils.toTitleCase(arrivalInfo.getHeadsign())); // Loop through the arrival times and create the TableRows that contains the data for (int i = 0; i < combinedArrivalInfoStyleB.getArrivalInfoList().size(); i++) { final ArrivalInfo arrivalRow = combinedArrivalInfoStyleB.getArrivalInfoList().get(i); final ObaArrivalInfo tempArrivalInfo = arrivalRow.getInfo(); long scheduledTime = tempArrivalInfo.getScheduledArrivalTime(); // Create a new row to be added final TableRow tr = (TableRow) inflater.inflate(R.layout.arrivals_list_tr_template_style_b, null); // Layout and views to inflate from XML templates RelativeLayout layout; TextView scheduleView, estimatedView, statusView; View divider; if (i == 0) { // Use larger styled layout/view for next arrival time layout = (RelativeLayout) inflater.inflate(R.layout.arrivals_list_rl_template_style_b_large, null); scheduleView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_schedule_large, null); estimatedView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_estimated_large, null); statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_large, null); } else { // Use smaller styled layout/view for further out times layout = (RelativeLayout) inflater.inflate(R.layout.arrivals_list_rl_template_style_b_small, null); scheduleView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_schedule_small, null); estimatedView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_estimated_small, null); statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_small, null); } // Set arrival times and status in views scheduleView.setText(DateUtils.formatDateTime(context, scheduledTime, DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT)); if (arrivalRow.getPredicted()) { long eta = arrivalRow.getEta(); if (eta == 0) { estimatedView.setText(R.string.stop_info_eta_now); } else { estimatedView.setText(eta + " min"); } } else { estimatedView.setText(R.string.stop_info_eta_unknown); } statusView.setText(arrivalRow.getStatusText()); int colorCode = arrivalRow.getColor(); statusView.setBackgroundResource(R.drawable.round_corners_style_b_status); GradientDrawable d = (GradientDrawable) statusView.getBackground(); d.setColor(context.getResources().getColor(colorCode)); int alpha; if (i == 0) { // Set next arrival alpha = (int) (1.0f * 255); // X percent transparency } else { // Set smaller rows alpha = (int) (.35f * 255); // X percent transparency } d.setAlpha(alpha); // Set padding on status view int pSides = UIUtils.dpToPixels(context, 5); int pTopBottom = UIUtils.dpToPixels(context, 2); statusView.setPadding(pSides, pTopBottom, pSides, pTopBottom); // Add TextViews to layout layout.addView(scheduleView); layout.addView(statusView); layout.addView(estimatedView); // Make sure the TextViews align left/center/right of parent relative layout RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) scheduleView.getLayoutParams(); params1.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params1.addRule(RelativeLayout.CENTER_VERTICAL); scheduleView.setLayoutParams(params1); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) statusView.getLayoutParams(); params2.addRule(RelativeLayout.CENTER_IN_PARENT); // Give status view a little extra margin int p = UIUtils.dpToPixels(context, 3); params2.setMargins(p, p, p, p); statusView.setLayoutParams(params2); RelativeLayout.LayoutParams params3 = (RelativeLayout.LayoutParams) estimatedView.getLayoutParams(); params3.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params3.addRule(RelativeLayout.CENTER_VERTICAL); estimatedView.setLayoutParams(params3); // Add layout to TableRow tr.addView(layout); // Add the divider, if its not the first row if (i != 0) { int dividerHeight = UIUtils.dpToPixels(context, 1); divider = inflater.inflate(R.layout.arrivals_list_divider_template_style_b, null); divider.setLayoutParams( new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, dividerHeight)); arrivalTimesLayout.addView(divider); } // Add click listener tr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFragment.showListItemMenu(tr, arrivalRow); } }); // Add TableRow to container layout arrivalTimesLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT)); } // Show or hide reminder for this trip ContentValues values = null; if (mTripsForStop != null) { values = mTripsForStop.getValues(arrivalInfo.getTripId()); } if (values != null) { String reminderName = values.getAsString(ObaContract.Trips.NAME); TextView reminder = (TextView) view.findViewById(R.id.reminder); if (reminderName.length() == 0) { reminderName = context.getString(R.string.trip_info_noname); } reminder.setText(reminderName); Drawable d = reminder.getCompoundDrawables()[0]; d = DrawableCompat.wrap(d); DrawableCompat.setTint(d.mutate(), view.getResources().getColor(R.color.theme_primary)); reminder.setCompoundDrawables(d, null, null, null); reminder.setVisibility(View.VISIBLE); } else { // Explicitly set reminder to invisible because we might be reusing // this view. View reminder = view.findViewById(R.id.reminder); reminder.setVisibility(View.GONE); } }
From source file:org.hfoss.posit.web.Communicator.java
public boolean sendFind(Find find, String action) { boolean success = false; String url;/*w w w . j a v a2 s . com*/ HashMap<String, String> sendMap = find.getContentMapGuid(); //Log.i(TAG, "sendFind map = " + sendMap.toString()); cleanupOnSend(sendMap); sendMap.put("imei", imei); String guid = sendMap.get(PositDbHelper.FINDS_GUID); // Create the url if (action.equals("create")) { url = server + "/api/createFind?authKey=" + authKey; } else { url = server + "/api/updateFind?authKey=" + authKey; } if (Utils.debug) { Log.i(TAG, "SendFind=" + sendMap.toString()); } // Send the find try { responseString = doHTTPPost(url, sendMap); } catch (Exception e) { Log.i(TAG, e.getMessage()); Utils.showToast(mContext, e.getMessage()); } if (Utils.debug) Log.i(TAG, "sendFind.ResponseString: " + responseString); // If the update failed return false if (responseString.indexOf("True") == -1) { Log.i(TAG, "sendFind result doesn't contain 'True'"); return false; } else { PositDbHelper dbh = new PositDbHelper(mContext); long id = find.getId(); success = dbh.markFindSynced(id); if (Utils.debug) Log.i(TAG, "sendfind synced " + id + " " + success); } if (!success) return false; // Otherwise send the Find's images long id = Long.parseLong(sendMap.get(PositDbHelper.FINDS_ID)); PositDbHelper dbh = new PositDbHelper(mContext); ArrayList<ContentValues> photosList = dbh.getImagesListSinceUpdate(id); Log.i(TAG, "sendFind, photosList=" + photosList.toString()); Iterator<ContentValues> it = photosList.listIterator(); while (it.hasNext()) { ContentValues imageData = it.next(); Uri uri = Uri.parse(imageData.getAsString(PositDbHelper.PHOTOS_IMAGE_URI)); String base64Data = convertUriToBase64(uri); uri = Uri.parse(imageData.getAsString(PositDbHelper.PHOTOS_THUMBNAIL_URI)); String base64Thumbnail = convertUriToBase64(uri); sendMap = new HashMap<String, String>(); sendMap.put(COLUMN_IMEI, Utils.getIMEI(mContext)); sendMap.put(PositDbHelper.FINDS_GUID, guid); sendMap.put(PositDbHelper.PHOTOS_IDENTIFIER, imageData.getAsString(PositDbHelper.PHOTOS_IDENTIFIER)); sendMap.put(PositDbHelper.FINDS_PROJECT_ID, imageData.getAsString(PositDbHelper.FINDS_PROJECT_ID)); sendMap.put(PositDbHelper.FINDS_TIME, imageData.getAsString(PositDbHelper.FINDS_TIME)); sendMap.put(PositDbHelper.PHOTOS_MIME_TYPE, imageData.getAsString(PositDbHelper.PHOTOS_MIME_TYPE)); sendMap.put("mime_type", "image/jpeg"); sendMap.put(PositDbHelper.PHOTOS_DATA_FULL, base64Data); sendMap.put(PositDbHelper.PHOTOS_DATA_THUMBNAIL, base64Thumbnail); sendMedia(sendMap); //it.next(); } // Update the Synced attribute. return true; }
From source file:com.android.mail.providers.Attachment.java
/** * Create an attachment from a {@link ContentValues} object. * The keys should be {@link AttachmentColumns}. *///from w w w . ja v a 2 s .c o m public Attachment(ContentValues values) { name = values.getAsString(AttachmentColumns.NAME); size = values.getAsInteger(AttachmentColumns.SIZE); uri = parseOptionalUri(values.getAsString(AttachmentColumns.URI)); contentType = values.getAsString(AttachmentColumns.CONTENT_TYPE); state = values.getAsInteger(AttachmentColumns.STATE); destination = values.getAsInteger(AttachmentColumns.DESTINATION); downloadedSize = values.getAsInteger(AttachmentColumns.DOWNLOADED_SIZE); contentUri = parseOptionalUri(values.getAsString(AttachmentColumns.CONTENT_URI)); thumbnailUri = parseOptionalUri(values.getAsString(AttachmentColumns.THUMBNAIL_URI)); previewIntentUri = parseOptionalUri(values.getAsString(AttachmentColumns.PREVIEW_INTENT_URI)); providerData = values.getAsString(AttachmentColumns.PROVIDER_DATA); supportsDownloadAgain = values.getAsBoolean(AttachmentColumns.SUPPORTS_DOWNLOAD_AGAIN); type = values.getAsInteger(AttachmentColumns.TYPE); flags = values.getAsInteger(AttachmentColumns.FLAGS); partId = values.getAsString(AttachmentColumns.CONTENT_ID); }