(room) add room gradle file
This commit is contained in:
parent
6ce3b98615
commit
451229779f
|
@ -54,7 +54,10 @@ dependencies {
|
||||||
exclude module: 'support-v4'
|
exclude module: 'support-v4'
|
||||||
}
|
}
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
|
|
||||||
|
//room
|
||||||
compile "android.arch.persistence.room:runtime:1.0.0-alpha3"
|
compile "android.arch.persistence.room:runtime:1.0.0-alpha3"
|
||||||
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha3"
|
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha3"
|
||||||
|
compile "android.arch.persistence.room:rxjava2:1.0.0-alpha2"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,10 @@ public class TuskyApplication extends Application {
|
||||||
|
|
||||||
private static AppDatabase db;
|
private static AppDatabase db;
|
||||||
|
|
||||||
|
public static AppDatabase getDB() {
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
@ -54,10 +58,6 @@ public class TuskyApplication extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
db = Room.databaseBuilder(getApplicationContext(),
|
db = Room.databaseBuilder(getApplicationContext(),
|
||||||
AppDatabase.class, "tuskyDB").build();
|
AppDatabase.class, "tuskyDB").allowMainThreadQueries().build();
|
||||||
}
|
|
||||||
|
|
||||||
public static AppDatabase getDB() {
|
|
||||||
return db;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue