Exercises

2.3 Fill in the blanks in each of the following statements:

a) The ADT’s _____________ allows you to build GUIs using drag-and-drop techniques.

b) For an Android app that you create with Eclipse, the GUI layout is stored in an XML file called _____________, by default.

c) The default GUI for a Blank Page app consists of a(n) _____________ (layout) with a light-gray background and a TextView containing "Hello world!".

d) Your project’s res folder contains three subfolders for images—drawable-hdpi (high density), drawable-mdpi (medium density) and drawable-ldpi (low density). These folders store images with different _____________ densities.

e) The documentation for supporting multiple screen sizes recommends that you use density-independent pixels for the dimensions of GUI components and other screen elements and _____________ for font sizes.

f) One density-independent pixel is equivalent to one pixel on a screen with 160 dpi (dots per inch). On a screen with 240 dpi, each density-independent pixel will be scaled by a factor of _____________.

g) On a screen with 120 dpi, each density-independent pixel is scaled by a factor of _____________. So, the same component that’s 100 density-independent pixels wide will be 75 actual pixels wide.

2.4 State whether each of the following is true or false. If false, explain why.

a) For images to render nicely, a high-pixel-density device needs lower-resolution images than a low-pixel-density device.

b) It’s considered a good practice to “externalize” strings, string arrays, images, colors, font sizes, dimensions and other app resources so that you, or someone else on your team, can manage them separately from your application’s code.

c) You can use the Graphical Layout editor to create a working Android app without writing any code.

2.5 (Scrapbooking App) Find four open source images of famous landmarks using websites such as Flickr. Create an app in which you arrange the images in a collage. Add text that identifies each landmark. Recall that image file names must use all lowercase letters.

2.6 (Scrapbooking App with Accessibility) Using the techniques you learned in Section 2.7, enhance your solution to Exercise 2.5 to provide strings that can be used with Android’s TalkBack accessibility feature. If you have an Android device available to you, test the app on the device with TalkBack enabled.

2.7 (Scrapbooking App with Internationalization) Using the techniques you learned in Section 2.8, enhance your solution to Exercise 2.6 to define a set of strings for another spoken language. Use an online translator service, such as translate.google.com to translate the strings and place them in the appropriate strings.xml resource file. Use the instructions in Section 2.8 to test the app on an AVD (or a device if you have one available to you).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.183.152