Skip to content
KnowledgeCity

Java for Android: Manage Graphical Resources

Learn for mobile functionality with this Intermediate Java for Android Programming course.
Preview the first lesson free — get full access to all 10 lessons.
Course: On-Demand
Intermediate Provider Shad Sluiter  10 Lessons ·  44m  in Arabic, German, English, Spanish, French, Portuguese, Chinese 

Course Description

In this section you will create a game that utilizes graphics. We will import JPEG files into the Android project in the appropriate resource folder and access these from within the Java code. Additionally, the game utilizes a random number generator to allow the player to compete against the computer. The game score, computer choice, user choice and other statistics are encapsulated in a game state class, giving us another demonstration of object-oriented programming techniques.

What You'll Learn

  • Import graphical resources such as JPEG files into the appropriate Android resource folder and access them from Java code
  • Manage the properties of an ImageView control and create a layout for images and text
  • Generate random numbers and use them to manage game play and handle computer choices
  • Encapsulate related properties of a game into a single game state class variable
  • Build a common click listener and update TextView and ImageView controls on a button click
  • Determine a winner, calculate the score, update the UI, and refactor the app

Key Takeaways

  • The course builds a Rock, Paper, Scissors game that uses imported graphics to teach Android resource management.
  • Graphical resources like JPEG files are imported into the appropriate Android resource folder and accessed from within the Java code.
  • A random number generator lets the player compete against the computer during game play.
  • The game score, computer choice, user choice, and other statistics are encapsulated in a game state class, demonstrating object-oriented programming techniques.
  • Lessons walk through creating game graphics, building layouts, handling selections, determining a winner and score, and refactoring the app.

Frequently Asked Questions

What project will I build in this course?

You will create a Rock, Paper, Scissors game that utilizes graphics, where a random number generator allows the player to compete against the computer.

What will I learn about handling graphics in Android?

You will learn to import graphical resources such as JPEG files into the appropriate Android resource folder, access them from Java code, and manage the properties of an ImageView control.

How does this course demonstrate object-oriented programming?

The game score, computer choice, user choice, and other statistics are encapsulated in a single game state class variable, providing a demonstration of object-oriented programming techniques.

What topics do the lessons cover?

Lessons cover creating game graphics, building a layout for images and text, creating a common click listener, updating the TextView and ImageView on selections, handling computer choices, determining a winner and the score, updating the UI, and refactoring the app.