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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:58:16+00:00 2026-06-12T00:58:16+00:00

I am currently trying to access my database using my android phone however it

  • 0

I am currently trying to access my database using my android phone however it doesn’t work. It does work on the emulator. So I was wondering if I need to copy the data into my phone’s internal memory by using

try{
    InputStream myInput = myContext.getAssets().open(DB_NAME);

    // Path to the just created empty db
    String outFileName = DB_PATH + DB_NAME;

    //Open the empty db as the output stream
    OutputStream myOutput = new FileOutputStream(outFileName);

    //transfer bytes from the inputfile to the outputfile
    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();
    }catch(SQLiteException e){

Another issue is that I did not use “SQLiteOpenHelper”, so does the above method still work? I simply did a

   private final String DB_NAME = "MemberData";
private final String TABLE_NAME = "MemberDB";    
sampleDB =  this.openOrCreateDatabase(DB_NAME, MODE_PRIVATE, null);
        Cursor c = sampleDB.rawQuery("SELECT companyNameEng FROM " +
                TABLE_NAME + " ORDER BY companyNameEng ASC", null);
  • 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-12T00:58:17+00:00Added an answer on June 12, 2026 at 12:58 am

    Yes, you must copy the db file out of the apk and into your apps database directory (or somewhere else that your app can access). The assets directory is not really a directory when the .apk file is created… it’s just data that certain functions in the framework (getAssets()) know how to access. To allow other functions that expect a real path to work, you need to copy the data out to a proper directory on the device.

    The usual destination for a database is “data/data/your.package.name/databases/”.

    Your method looks like will work fine… it is standard java io. SQLiteOpenHelper is more for helping you do upgrades and create new dbs. I always use one (never know if I’m going to change how I do things even if I don’t need it initially), but you certainly don’t have to.

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

Sidebar

Related Questions

I'm currently trying to access a REST API for the first time using visual
I am currently trying to access the data that was just inserted using: if($this->User->save($this->data))
I am trying to access to HTML5 database when I was building an Android
I'm currently trying to access Active Directory via the dbms_ldap API in Pl/Sql (Oracle).
Im currently trying to downlaod a audio track from a WCF, i need some
I'm currently trying to set up my TableAdapters, but it doesn't allow me to
I'm trying to update location data to a web database using BroadcastReceiver and Service
I am currently trying out visual studio to access sql server databases instead of
I'm currently trying to set up a small PostgreSQL database server with Debian Linux
I'm trying to use a database I have in Access 2010 and trying to

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.