Created
April 3, 2017 22:02
-
-
Save cosbor11/759690ec689f49873304d1c00337c91b to your computer and use it in GitHub Desktop.
Persist data within an Android application
This file contains hidden or 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
final CookBook cookBook = new CookBook(); | |
cookBook.setTitle("Onyx's House of Yummy"); | |
final Recipe cupOfNoodle = new Recipe(); | |
cupOfNoodle.setContent("Cup of Noodle"); | |
cupOfNoodle.setDetails("Open lid, add water, put powder stuff in and microwave until it boils over and makes a mess in your microwave."); | |
List<Recipe> recipees = new ArrayList<>(); | |
recipees.add(cupOfNoodle); | |
cookBook.setRecipes(recipees); | |
try { | |
persistenceManager.saveEntity(cookBook); | |
} catch (EntityException e) { | |
Log.e(TAG, "Could not persist cookbook"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment