use of in.testpress.testpress.models.Category in project android by testpress.
the class PostsListFragment method writeToDB.
protected void writeToDB(List<Post> posts) {
// Insert the categories and posts to the database
List<Category> categories = new ArrayList<Category>();
for (Post post : posts) {
if (post.category != null) {
Ln.e("Post category for " + post.getTitle() + " is " + post.category.getName());
categories.add(post.category);
} else {
Ln.e("Post category for " + post.getTitle() + " is null");
}
}
categoryDao.insertOrReplaceInTx(categories);
postDao.insertOrReplaceInTx(posts);
LogAllPosts();
}