In this video, Doug Winnie adds new Java code to make the ImageViews for the dice dynamically update based on the random numbers that are generated in the app. Using a loop, you can go through the ArrayList collections and use project assets to change the source of ImageView widgets.
- [Instructor] With our widgets created and…linked with our Java code,…we can now make the images dynamic and…change them based on the values we get…from our random number generator.…We need to do two things to make that work.…The first thing is alter how we are working with our images…and then we will create a loop to sort through…the die values and the die images and…update which images they display.…In Android, there are two main ways to store images.…One, is saving them as a drawable.…Drawables are good options for images that you use…once in your app and don't change dynamically.…
The other is to save them as a project asset.…Assets are better solutions for dynamic images.…If you try and use drawables, it is common…to run out of memory when you run your app.…So, Assets are the better way to do this.…When you create a new Android project,…it sometimes creates the drawable folder for you.…You have to create the assets folder on your own…and it requires some unique steps.…Open the project for this movie,…and right-click on the Res folder in your project.…
- Installing Android Studio
- Coding in Java and XML
- Getting a head start with starter templates
- Working with emulators
- Creating a project, variable, and toast
- Connecting XML widgets to code
- Adding images
- Adding game logic with conditional statements and operators
- Changing the data or design
Skill Level Beginner
1. Android Basics
Test your setup2m 56s
3. The Major Parts
4. Make an App
5. Tinkering with Your App
Next steps1m 4s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.