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

  • Home
  • SEARCH
  • 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 8548253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:27:08+00:00 2026-06-11T13:27:08+00:00

When you use emulator your sqlite file is stored in a folder near your

  • 0

When you use emulator your sqlite file is stored in a folder near your main application folder and you can download it. But this feature is not accessible in not rooted devices. How can I backup this existing sqlite file in SD Card programmatically?

I want to have a button in my application that stores this file in a special path in my SD Card. Is it possible?

Thanks,

  • 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-06-11T13:27:09+00:00Added an answer on June 11, 2026 at 1:27 pm

    You can try this, work for me, remember to get the WRITE_EXTERNAL_STORAGE permission in your manifest:

    // Copy to sdcard for debug use
        public static void copyDatabase(Context c, String DATABASE_NAME) {
            String databasePath = c.getDatabasePath(DATABASE_NAME).getPath();
            File f = new File(databasePath);
            OutputStream myOutput = null;
            InputStream myInput = null;
            Log.d("testing", " testing db path " + databasePath);
            Log.d("testing", " testing db exist " + f.exists());
    
            if (f.exists()) {
                try {
    
                    File directory = new File("/mnt/sdcard/DB_DEBUG");
                    if (!directory.exists())
                        directory.mkdir();
    
                    myOutput = new FileOutputStream(directory.getAbsolutePath()
                            + "/" + DATABASE_NAME);
                    myInput = new FileInputStream(databasePath);
    
                    byte[] buffer = new byte[1024];
                    int length;
                    while ((length = myInput.read(buffer)) > 0) {
                        myOutput.write(buffer, 0, length);
                    }
    
                    myOutput.flush();
                } catch (Exception e) {
                } finally {
                    try {
                        if (myOutput != null) {
                            myOutput.close();
                            myOutput = null;
                        }
                        if (myInput != null) {
                            myInput.close();
                            myInput = null;
                        }
                    } catch (Exception e) {
                    }
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to implement FizzBuzz in DCPU-16. I use this web emulator: http://mappum.github.com/DCPU-16/ (repository:
In my application, which I test on emulator, I use the following code to
How can I connect my Android emulator to the internet, e.g. to use the
I am trying to use AndroidHttpClient to download a CSV file. For some reason
From your experience as an android developer what emulator screen sizes do you use?
I need to use my phone as emulator/target/virtual device when I run my application.
I use this tutorial: Tutorial Custom database I copy database from assets folder and
In first place, I use the emulator to test this. I want to open
use C#,want to upload excel file on google doc. bellow syntax use to upload
is it possible to create java libraries the apps can use shared? It is

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.