title: SQLite app works on emulator but not in phone seems database error
body: <p>I have an working on a SQLite app and I am new to Android. Everything works fine for me in emulator and when I install in phone unfortunately my app closes. I searched in StackOverflow and googled it, and I find some solutions but nothing worked. Finally I need some help. </p>
  
  <p>My code to getdb from assets is:</p>
  
  <pre><code>private void copyDatabaseFromAssets() {
          // TODO Auto-generated method stub
          InputStream inputStream = null;
          OutputStream outputStream = null;
          String DataBasePath = DATABASE_PATH + DATABASE_NAME;
          try{
  
              inputStream = context.getAssets().open(DATABASE_NAME);
              outputStream =new FileOutputStream(DataBasePath);
              byte[] buffer = new byte[1024];
              int length;
              while((length =inputStream.read(buffer))&gt;0){
                  outputStream.write(buffer, 0, length);
              }
              outputStream.flush();
              outputStream.close();
              inputStream.close();
  
          }catch(IOException e){
              throw new Error("Problem copying database from resource file");
          }
  
  }
  </code></pre>