Created
March 17, 2014 15:20
-
-
Save mikeholler/9601206 to your computer and use it in GitHub Desktop.
Maintain only one static database connection in Android. From http://touchlabblog.tumblr.com/post/24474750219/single-sqlite-connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DatabaseHelper extends OrmLiteSqliteOpenHelper | |
{ | |
private static DatabaseHelper instance; | |
public static synchronized DatabaseHelper getHelper(Context context) | |
{ | |
if (instance == null) | |
instance = new DatabaseHelper(context); | |
return instance; | |
} | |
//Other stuff... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment