Note that there are some explanatory texts on larger screens.

plurals
  1. POin android data/data/.....geting only half database
    primarykey
    data
    text
    <p>i have created database for android application and its size is 30 kb i have placed this database in to asset folder and used below code for paste it in to <code>data/data/........</code> i am getting only 1/3 of my database after run on emulator. Is any one faced this problem earlier.</p> <p>//enter code here</p> <pre><code> private boolean checkDataBase() { SQLiteDatabase checkDB = null; try { String myPath = DB_PATH + DB_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); } catch (SQLiteException e) { // database does't exist yet. Log.i("database", "NOT EXIST"); } if (checkDB != null) { checkDB.close(); } return checkDB != null ? true : false; } private void copyDataBase() { FileInputStream myInput = null; String outFileName; FileOutputStream myOutput = null; try{ // Open your local db as the input stream //InputStream myInput = myContext.getResources().openRawResource(R.drawable.menu); myInput = (FileInputStream) myContext.getAssets().open(DB_NAME); // Path to the just created empty db outFileName = DB_PATH + DB_NAME; // Open the empty db as the output stream myOutput = new FileOutputStream(outFileName); // transfer bytes from the inputfile to the outputfile try{ byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) &gt; 0) { myOutput.write(buffer, 0, length); } }catch (Exception e) { Log.i("catch ", "Ecxeption"+e.getMessage()); // TODO: handle exception } }catch (Exception e) { // TODO: handle exception }finally{ try{ // Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } catch (Exception e2) { // TODO: handle exception } } } </code></pre> <p>when i am running this code in emulator then i found my database in to data/data/....... but i found only 7 kb database. please help me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload