Skip to content

Commit 7595b16

Browse files
committed
Add desc for room inMemory db and bump version
1 parent 8507529 commit 7595b16

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
### Using Android Debug Database Library in your application
3737
Add this to your app's build.gradle
3838
```groovy
39-
debugCompile 'com.amitshekhar.android:debug-db:1.0.2'
39+
debugCompile 'com.amitshekhar.android:debug-db:1.0.3'
4040
```
4141

4242
Use `debugCompile` so that it will only compile in your debug build and not in your release build.
@@ -95,7 +95,7 @@ public static void showDebugDBAddressLogToast(Context context) {
9595
```
9696

9797
### Adding custom database files
98-
As this library is auto-initialize, if you want to add custom database files, add the following method and call
98+
As this library is auto-initialize, if you want to debug custom database files, add the following method and call
9999
```java
100100
public static void setCustomDatabaseFiles(Context context) {
101101
if (BuildConfig.DEBUG) {
@@ -116,6 +116,26 @@ public static void setCustomDatabaseFiles(Context context) {
116116
}
117117
```
118118

119+
### Adding InMemory Room databases
120+
As this library is auto-initialize, if you want to debug inMemory Room databases, add the following method and call
121+
```java
122+
public static void setInMemoryRoomDatabases(SupportSQLiteDatabase... database) {
123+
if (BuildConfig.DEBUG) {
124+
try {
125+
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
126+
Class[] argTypes = new Class[]{HashMap.class};
127+
HashMap<String, SupportSQLiteDatabase> inMemoryDatabases = new HashMap<>();
128+
// set your inMemory databases
129+
inMemoryDatabases.put("InMemoryOne.db", database[0]);
130+
Method setRoomInMemoryDatabase = debugDB.getMethod("setInMemoryRoomDatabases", argTypes);
131+
setRoomInMemoryDatabase.invoke(null, inMemoryDatabases);
132+
} catch (Exception ignore) {
133+
134+
}
135+
}
136+
}
137+
```
138+
119139
### Find this project useful ? :heart:
120140
* Support it by clicking the :star: button on the upper right of this page. :v:
121141

app/src/main/java/com/sample/utils/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static void setInMemoryRoomDatabases(SupportSQLiteDatabase... database) {
7878
Class<?> debugDB = Class.forName("com.amitshekhar.DebugDB");
7979
Class[] argTypes = new Class[]{HashMap.class};
8080
HashMap<String, SupportSQLiteDatabase> inMemoryDatabases = new HashMap<>();
81-
// set your inMemory database
81+
// set your inMemory databases
8282
inMemoryDatabases.put("InMemoryOne.db", database[0]);
8383
Method setRoomInMemoryDatabase = debugDB.getMethod("setInMemoryRoomDatabases", argTypes);
8484
setRoomInMemoryDatabase.invoke(null, inMemoryDatabases);

debug-db/debug-db-upload.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def siteUrl = 'https://github.com/amitshekhariitbhu/Android-Debug-Database'
2424
def gitUrl = 'https://github.com/amitshekhariitbhu/Android-Debug-Database.git'
2525

2626
group = "com.amitshekhar.android"
27-
version = '1.0.2'
27+
version = '1.0.3'
2828

2929
install {
3030
repositories.mavenInstaller {

0 commit comments

Comments
 (0)