-
-
Notifications
You must be signed in to change notification settings - Fork 797
/
SqliteUtils.java
37 lines (30 loc) · 910 Bytes
/
SqliteUtils.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.github.lazylibrary.util;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
/**
* SqliteUtils
*
* @author <a href="http://www.trinea.cn" target="_blank">Trinea</a> 2013-10-21
*/
public class SqliteUtils {
private static volatile SqliteUtils instance;
private DbHelper dbHelper;
private SQLiteDatabase db;
private SqliteUtils(Context context) {
dbHelper = new DbHelper(context);
db = dbHelper.getWritableDatabase();
}
public static SqliteUtils getInstance(Context context) {
if (instance == null) {
synchronized (SqliteUtils.class) {
if (instance == null) {
instance = new SqliteUtils(context);
}
}
}
return instance;
}
public SQLiteDatabase getDb() {
return db;
}
}