MyDb db = new MyDb(context); try { // Do stuff db.open(); } catch (SQLException ex) { // Exception handling stuff } finally { if (db != null) { try { db.close(); } catch (SQLException e) { /* ignored */} } } Please enable JavaScript to view the comments powered by Disqus.