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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:28:51+00:00 2026-05-18T01:28:51+00:00

I adapted this tutorial (http://www.screaming-penguin.com/node/7749) to an Android app I’ve built to allow for

  • 0

I adapted this tutorial (http://www.screaming-penguin.com/node/7749) to an Android app I’ve built to allow for a button press to export the current database to the user’s sdcard. It works flawlessly.

But I’m afraid that users of my app would be unfamiliar with the db file, and I’m looking for a way to convert that to a more user-friendly format. I came across this thread (http://groups.google.com/group/android-beginners/browse_thread/thread/4e53ebca14daecfc), which recommends “querying data from the database and writing the data into a csv file.”

I was hoping someone could point me in the right direction to begin figuring out how to do this. I’m finding it hard to track down more information about the specific method.

Or does it make more sense to just explain in a short “about” how to read and access .db files?

Thanks

EDIT: I also have a question about the sqlite export process, which I think I’ll just ask here rather than create a new question. Is there a way to modify the code below so that each export would receive either a string representation of the date or just a single numeral appended to it? Right now if you export a second time, it automatically overwrites the old file. Thanks.

protected Boolean doInBackground(final String... args) {

        File dbFile = new File(Environment.getDataDirectory() + 
                "/data/com.example.example/databases/data");

        File exportDir = new File(Environment.getExternalStorageDirectory(), "exampledata");

        if (exportDir.exists()) {
            exportDir.mkdirs();
        }

        File file = new File(exportDir, dbFile.getName());

        try {
            file.createNewFile();
            this.copyFile(dbFile, file);
            return true;
        } catch(IOException e) {
            Log.e(MyApplication.APP_NAME, e.getMessage(), e);
            return false;
        }

    }
  • 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-18T01:28:52+00:00Added an answer on May 18, 2026 at 1:28 am

    I was hoping someone could point me in the right direction to begin figuring out how to do this.

    To read in the data, use rawQuery().

    To write the data, use Java I/O. There are also open source CSV libraries for Java that may work on Android.

    Is there a way to modify the code below so that each export would receive either a string representation of the date or just a single numeral appended to it?

    Use string concatenation to add whatever you want to the filename.

    Also, please get rid of:

    File dbFile = new File(Environment.getDataDirectory() + 
                    "/data/com.example.example/databases/data");
    

    and replace it with:

    File dbFile=getDatabasePath("data");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an adapted version of a question from someone in my office. She's
I am following this tutorial . All is going well until I try create
Working through a zend tutorial & get this message, & not sure where to
I'm following the example on the android tutorial about the GridView, but instead of
I've adapted this from an example that I found on the 'net... function ratio($a,
I have adapted a jQuery tabbed interface tutorial to create an interface for viewing
I have this adapted javascript code to display funfacts about anything (in this case
So: I have the following function, adapted from a formula found online, which takes
Basically, we have this here module that we offer to our users that want
I'm trying to get into android development and I'm going through the tutorials, however

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.