Last active
April 30, 2018 12:24
-
-
Save tpakis/1dd3db18fbf31208ea568b2a9ab1e463 to your computer and use it in GitHub Desktop.
Async call to load from
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
private void loadAllRecipesFromDB() { | |
Timber.d("loadAllRecipesFromDB"); | |
new AsyncTask<Void, Void, List<Recipe>>() { | |
@Override | |
protected List<Recipe> doInBackground(Void...a) { | |
return recipesDAO.getAllEntries(); | |
} | |
@Override | |
protected void onPostExecute(List<Recipe> results) { | |
//check if there are data in the db | |
if ((results != null)&&results.size()>0) { | |
setRecipesListObservableData(results, null); | |
} | |
} | |
}.execute(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment