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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:22:07+00:00 2026-05-26T04:22:07+00:00

Possible Duplicate: Is it possible to copy database file to SD card? I have

  • 0

Possible Duplicate:
Is it possible to copy database file to SD card?

I have a database on my Android phone, and I need to get the information onto an SD card.

Is it possible to save the database file onto the SD card in a readable state? I haven’t been able to find any information on how to do this. I know the name of the database, and fields etc…

I’ve found some examples that show how to save to SD cards, but not exactly what I need.

Some source code that copies the database file to an SD card would be perfect.

Hopefully this question is clear enough.

  • 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-26T04:22:07+00:00Added an answer on May 26, 2026 at 4:22 am

    Yes. Here is the function that i use:

    public void copyDBToSDCard() {
        try {
            InputStream myInput = new FileInputStream("/data/data/com.myproject/databases/"+DATABASE_NAME);
    
            File file = new File(Environment.getExternalStorageDirectory().getPath()+"/"+DATABASE_NAME);
            if (!file.exists()){
                try {
                    file.createNewFile();
                } catch (IOException e) {
                    Log.i("FO","File creation failed for " + file);
                }
            }
    
            OutputStream myOutput = new FileOutputStream(Environment.getExternalStorageDirectory().getPath()+"/"+DATABASE_NAME);
    
            byte[] buffer = new byte[1024];
            int length;
            while ((length = myInput.read(buffer))>0){
                myOutput.write(buffer, 0, length);
            }
    
            //Close the streams
            myOutput.flush();
            myOutput.close();
            myInput.close();
            Log.i("FO","copied");
    
        } catch (Exception e) {
            Log.i("FO","exception="+e);
        }
    
    
    }
    

    For a project that I worked on, I put a menu option in the home screen that I could call this function from at any time. Then, I’d move the database to my desktop and open it up with the SQLite Manager plugin for FireFox.

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

Sidebar

Related Questions

Possible Duplicate: How disable Copy, Cut, Select, Select All in UITextView I have some
Possible Duplicate: question about copy constructor if I have this snippet of the code
Possible Duplicate: How to copy a file to another path? hi, how to copy
Possible Duplicate: how to copy char * into a string and vice-versa I have
Possible Duplicate: How do I copy an object in Java? I need to copy
Possible Duplicate: When do we have to use copy constructors? Why exactly are C++
Possible Duplicate: How to copy an object in objective c I have a very
Possible Duplicate: deep copy NSMutableArray in Objective-C ? I have two arrays of length
Possible Duplicate: Warning: The Copy Bundle Resources build phase contains this target's Info.plist file
Possible Duplicate: How to programmatically copy/paste in windows phone? how can i use clipboard

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.