Code example for ContentValues

Methods: insertput

    public static Uri insertContent(Context context, Uri sourceUri, File file, String saveFileName,
            long time) {
        time /= 1000;
        final ContentValues values = new ContentValues();
        values.put(Images.Media.TITLE, saveFileName);
        values.put(Images.Media.DISPLAY_NAME, file.getName());
        values.put(Images.Media.MIME_TYPE, "image/jpeg");
        values.put(Images.Media.DATE_TAKEN, time);
        values.put(Images.Media.DATE_MODIFIED, time);
        values.put(Images.Media.DATE_ADDED, time);
        values.put(Images.Media.ORIENTATION, 0);
        values.put(Images.Media.DATA, file.getAbsolutePath());
        values.put(Images.Media.SIZE, file.length());
        final String[] projection = new String[] {
                ImageColumns.LATITUDE, ImageColumns.LONGITUDE,
        querySource(context, sourceUri, projection,
                new ContentResolverQueryCallback() { 
                    public void onCursorResult(Cursor cursor) {
                        values.put(Images.Media.DATE_TAKEN, cursor.getLong(0));
                        double latitude = cursor.getDouble(1);
                        double longitude = cursor.getDouble(2);
                        // TODO: Change || to && after the default location 
                        // issue is fixed. 
                        if ((latitude != 0f) || (longitude != 0f)) {
                            values.put(Images.Media.LATITUDE, latitude);
                            values.put(Images.Media.LONGITUDE, longitude);
        return context.getContentResolver().insert(
                Images.Media.EXTERNAL_CONTENT_URI, values);
    public static Uri makeAndInsertUri(Context context, Uri sourceUri) {
        long time = System.currentTimeMillis();
Connect your IDE to all the code out there  Get Codota for Java