コード例 #1
0
  /**
   * Try to close everything when destroyed.
   *
   * @throws Throwable reference:
   *     http://stackoverflow.com/questions/4557154/android-sqlite-db-when-to-close
   *     http://stackoverflow.com/questions/14469782/android-sqlite-right-way-to-open-close-db
   */
  @Override
  public void finalize() throws Throwable {
    closeDatabase();
    //        if (mInstance != null) {
    //            mInstance.close();
    //        }

    super.finalize();
  }
コード例 #2
0
 @Override
 protected void finalize() throws Throwable {
   db.close();
   super.finalize();
 }