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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:36:13+00:00 2026-06-13T21:36:13+00:00

When I export a database on sd card I use try { File sd

  • 0

When I export a database on sd card I use

try {
    File sd = new File(Environment.getExternalStorageDirectory()+"/ABC");
                    File data = Environment.getDataDirectory();
                    boolean success = false;
                    if (!sd.exists()) {
                        success = sd.mkdir();
                    }
                    if (sd.canWrite()) {
                        String currentDBPath = "\\data\\com.example.skurat\\databases\\Income.db";
                        String backupDBPath = "Income.db";
                        File currentDB = new File(data, currentDBPath);
                        File backupDB = new File(sd, backupDBPath);

                        if (currentDB.exists() && success) {
                            FileChannel src = new FileInputStream(currentDB).getChannel();
                            FileChannel dst = new FileOutputStream(backupDB).getChannel();
                            dst.transferFrom(src, 0, src.size());
                            src.close();
                            dst.close();
                        }
                    }
                } catch (Exception e) {
                }

as a result file “Income.db” is stored on the sd card.

When I import a new database from sd card I use

File dbfile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +"/ABC/Income.db" ); 
             String backupDBPath = "Income.db";
             File backupDB = new File(dbfile, backupDBPath);
            SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);
            // toDoDBAdapter = new DBAdapter(this, "Income.db"); written in the "onCreate" method, working correctly
            toDoDBAdapter.dbHelper.onUpgrade(db, 1, 2);
            // refresh screen, working correctly
            populateTodoList();

And database is not updated. Why? I use API 7

p.s.

If you know another way to import the database from sd card in the application, please tell, 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-13T21:36:14+00:00Added an answer on June 13, 2026 at 9:36 pm

    There is no code that imports the database. Your code just calls onUpgrade on the database on the SD card.

    You have to copy the database file back, like you do for export. Alternatively, you have to copy the records from that database into your normal database.

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

Sidebar

Related Questions

I am want to export database table to a file. I am using the
I'm writing a php script to export MySQL database rows into a .txt file
I want to export the database to CSV file and read in MatLab. I
I'm using php and mysql. When i try to export the database using phpMyAdmin.
I have data analysis application and I need to be able to export database
I've usually use mysqldump to export a database. However, when the database is really
Are there any good easy to use softwares to export Access Database files to
Currently I go into phpMyAdmin, export my database as a text file and then
Here is my problem: I export a database A_DB using export function of Phppgadmin.
is it possible to automatically export mysql database in phpmyadmin

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.