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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:49:49+00:00 2026-05-28T07:49:49+00:00

My application allows users to take a photo using the camera and save it

  • 0

My application allows users to take a photo using the camera and save it as their profile picture. There can be only 1 image stored at a time?

  • Is it a bad idea to use SharedPrefertences for this purpose although I am only storing 1 image? (Converting image to Base64). What are the cons?
  • If storing the image using shared preferences is not a good idea, what are the alternatives?
  • 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-28T07:49:49+00:00Added an answer on May 28, 2026 at 7:49 am

    I think storing binary data in SharedPreferences is not a good idea. Instead save it to the filesystem. Example for that, if the data is coming from an InputStream:

    storeImage( new File(context.getFilesDir().getAbsolutePath() + fileDir), 
                is, 
                "profile.png" ); 
    
    public static void storeImage( 
                File fileDir, 
                InputStream inputStream, 
                String fileName ) throws IOException {
        File file = new File( fileDir,fileName );
        FileOutputStream fos = new FileOutputStream( file );
        Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
        inputStream.close();
        fos.close();
        bitmap.recycle();
        bitmap = null;
    }
    

    Where context can be the Application/Activity context.

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

Sidebar

Related Questions

My application allows users to take photos with their devices camera app, which are
I have an android application which allows the user to take a picture using
I have an application that allows users to write their own code in a
I'm working on an application that allows users to add their own RSS feeds
I have a really simple Rails application that allows users to register their attendance
I have a fairly simple Rails application that allows users to manage their clients
I have a server application that allows users to execute their own ruby scripts.
My ASP .Net C# web application allows its users to send files from their
My ASP.NET application allows users to upload and download large files. Both procedures involve
I'm writing an application that allows users to upload images onto the server. I

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.