Created
September 28, 2018 12:55
-
-
Save MwBakker/1659873db95485630123f4816c83c554 to your computer and use it in GitHub Desktop.
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
// inner-class, extends possibility of async (since only one can be extended at the time) | |
// private so can't be a loose-filed class.. | |
// populates the DB with a dao coming from other thread(?) | |
private static class PopulateDbAsync extends AsyncTask<Void, Void, Void> { | |
private final StorageDao sDao; | |
PopulateDbAsync(StorageDatabase db) { sDao = db.storageDao(); } | |
@Override | |
protected Void doInBackground(final Void... params) { | |
sDao.deleteAll(); | |
Storage storage = new Storage(); | |
sDao.insert(storage); | |
storage = new Storage(); | |
sDao.insert(storage); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment