Android Programming The Big Nerd Ranch Guide by Bill Phillips, Chris Stewart, Kristin Marsicano (z-lib.org)

(gtxtreme123) #1

Adding resources to a project


Adding resources to a project


The next step is to add the image files to GeoQuiz’s resources.


Make sure the project tool window is displaying the Project view (select Project from the dropdown
at the top of the project tools window, as shown in Figure 1.13 in Chapter 1). Expand the contents
of GeoQuiz/app/src/main/res. You will see folders named mipmap-hdpi and mipmap-xhdpi, for
example, as shown in Figure 2.10.


Figure 2.10  A distinct lack of drawable directories


Back in the solutions file, select and copy the four directories that you located earlier: drawable-
hdpi, drawable-mdpi, drawable-xhdpi, and drawable-xxhdpi. In Android Studio, paste the copied
directories into app/src/main/res. You should now have four density-qualified directories, each with
an arrow_left.png and arrow_right.png file, as shown in Figure 2.11.

Free download pdf