Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5838775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:30:14+00:00 2026-05-22T11:30:14+00:00

I used this code snippet : ContentValues image = new ContentValues(); image.put(Images.Media.TITLE, ImageTitle); image.put(Images.Media.DISPLAY_NAME,

  • 0

I used this code snippet:

ContentValues image = new ContentValues();

image.put(Images.Media.TITLE, "ImageTitle");
image.put(Images.Media.DISPLAY_NAME, "Heart");
image.put(Images.Media.DESCRIPTION, "Heart");
image.put(Images.Media.DATE_ADDED, dateTaken);
image.put(Images.Media.DATE_TAKEN, dateTaken);
image.put(Images.Media.DATE_MODIFIED, dateTaken);
image.put(Images.Media.MIME_TYPE, "image/png");
image.put(Images.Media.ORIENTATION, 0);

File parent = imageFile.getParentFile();
String path = parent.toString().toLowerCase();
String name = parent.getName().toLowerCase();
image.put(Images.ImageColumns.BUCKET_ID, path.hashCode());
image.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, name);
image.put(Images.Media.SIZE, imageFile.length());

image.put("_data", imageFile.getAbsolutePath());

getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, image);

I create the image inside the cache directory of my application. I assume that the image is not copied into the media folder by the media provider and therefore not accessible from the media gallery application. Is it possible to add an image to the media gallery without writing the file to the mass storage of the phone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:30:14+00:00Added an answer on May 22, 2026 at 11:30 am

    I think that the answer you are looking for is described here. The second part of that section describes saving images. The gist of it appears to be that you first insert the ContentValues object into the content resolver, which returns a Uri object that the ContentResolver is willing to turn into an OutputStream for you that you can write the image to. The link provided includes the actual code you would need to do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to rotate an image in OpenCV. I've used this code that
I've just found in my java project this code snippet: List<IssueType> selectedIssueTypes = new
This code snippet used to work. I think a recent update of Google Chrome
I got code snippet from this site, which I used as shown below $data
I used this code snippet to export data to Excel using Open XML. The
I successfully have used this code snippet before, but with the file pointing to
I used this code to print the current page: <form> <input type=button value=Print onClick=window.print();
I have used this code for extracting urls from web page.But in the line
On a Vista dev machine I used this code successfully to change user Administrator
I am creating a rails app and have used this code in one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.