Last active
September 25, 2018 07:49
-
-
Save codeamt/e537a99e9355ab797d068c36f9b1c609 to your computer and use it in GitHub Desktop.
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
private void populateUI(Sandwich model) { | |
//get text views | |
TextView nameView = findViewById(R.id.name_tv); | |
TextView origin = findViewById(R.id.origin_tv); | |
TextView aka = findViewById(R.id.also_known_tv); | |
TextView descView = findViewById(R.id.description_tv); | |
TextView ingredients = findViewById(R.id.ingredients_tv); | |
//bind data to views | |
if(model != null) { | |
origin.setText(sandwich.getPlaceOfOrigin()); | |
descView.setText(sandwich.getDescription()); | |
nameView.setText(sandwich.getMainName()); | |
/* handle attributes populated with array items */ | |
//other names for sandwich | |
List<String> other_names = sandwich.getAlsoKnownAs(); | |
aka.setText(other_names); | |
//ingredients for sandwich | |
List<String> allIngredients = sandwich.getIngredients(); | |
ingredients.setText(allIngredients); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment