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 170767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:52:03+00:00 2026-05-11T12:52:03+00:00

I am working on a function to download an image from a web server,

  • 0

I am working on a function to download an image from a web server, display it on the screen, and if the user wishes to keep the image, save it on the SD card in a certain folder. Is there an easy way to take a bitmap and just save it to the SD card in a folder of my choice?

My issue is that I can download the image, display it on screen as a Bitmap. The only way I have been able to find to save an image to a particular folder is to use FileOutputStream, but that requires a byte array. I am not sure how to convert (if this is even the right way) from Bitmap to byte array, so I can use a FileOutputStream to write the data.

The other option I have is to use MediaStore :

MediaStore.Images.Media.insertImage(getContentResolver(), bm,     barcodeNumber + '.jpg Card Image', barcodeNumber + '.jpg Card Image'); 

Which works fine to save to SD card, but does not allow you to customize the folder.

  • 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. 2026-05-11T12:52:03+00:00Added an answer on May 11, 2026 at 12:52 pm
    try (FileOutputStream out = new FileOutputStream(filename)) {     bmp.compress(Bitmap.CompressFormat.PNG, 100, out); // bmp is your Bitmap instance     // PNG is a lossless format, the compression factor (100) is ignored } catch (IOException e) {     e.printStackTrace(); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a function to establish the entropy of a distribution. It
I was just working on a function that I needed to return two values,
I'm working on creating a call back function for an ASP.NET cache item removal
I'm working with LINQ to objects and have a function where in some cases
Working on an old site in asp classic. I want to write a function
I'm currently working on a Google Maps project and am implementing a search function.
I've got a (mostly) working plugin developed, but since its function is directly related
PHP (among others) will execute the deepest function first, working its way out. For
I'm working on a Java library and would like to remove some functions from
So I have working code that animates a BG image via a plugin. This

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.