A little bit of cleanup
This commit is contained in:
@@ -60,12 +60,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
if (db.noteDAO().getAll().isEmpty()) {
|
||||
Log.d("UIVIS", "This should be what runs when the DB is empty");
|
||||
noNotesText.setVisibility(VISIBLE);
|
||||
notesRecyclerView.setVisibility(View.GONE);
|
||||
} else {
|
||||
Log.d("UIVIS", "This should only run if there is something in the DB");
|
||||
Log.d("UIVIS", "DB Count: " + db.noteDAO().getAll().size());
|
||||
noNotesText.setVisibility(View.GONE);
|
||||
notesRecyclerView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public abstract class NoteDB extends RoomDatabase {
|
||||
public static NoteDB getDB(Context applicationContext) {
|
||||
if (db == null) {
|
||||
db = Room.databaseBuilder(applicationContext, NoteDB.class, "Notes")
|
||||
.allowMainThreadQueries()
|
||||
.allowMainThreadQueries() // This is critical to make this whole thing work
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user