Android apps can be installed on devices around the world. If you want to distribute your app to this large market, then you should provide alternative resources such as text, sound and images.
Android makes it easy to include alternative strings, sound files, layouts and images so that your app will work in any country and in any language.
Our tutorial app will show you how to include alternative text and image resources.
You should keep your resources, like images, strings, values, etc. separate from your code.
Some of the folders in the res directory
This is the 2nd part of a two part series of articles on designing Android apps for multiple screens. Here's a link to part 1, Different images for different devices: bitmaps, pixels and other things that go bump in the night
Put all images that you use in an Android app inside a drawable folder. You should also supply different size images for the different screen densities.
Android devices come in different shapes and sizes. Their screen sizes range from small phones to 10 inch tablets and larger TV’s. They also have different screen densities.
There are two main graphic types, bitmap and vector graphics.
Vector graphics describe an image according to its geometric characteristics and can be resized without losing quality.
In Android, we’re more interested in Bitmap images which are stored electronically as a map of bits.
Another electronic image term is the pixel. Sometimes bits and pixels are interchanged and a bitmap can refer to a map of pixels, where each pixel represents a colour.
Bitmaps are resolution dependent which means they contain a fixed number of pixels so they will lose quality if you change their size.
Application resources include images, text and music files. It is a good idea to store these in separate folders which makes it easier to maintain the code and to adapt your application for different languages and devices. You simply supply alternative resources for the different languages and devices and the system takes care of the rest.
Android for beginners Tutorials. Application Resources bundle describes the different types of resources that you can use and shows you where to put them. It also shows you how to use alternative resources so that your application can seamlessly work on different devices such as phones and tablets and also with different languages.
Android for beginners Tutorials. Application Resources bundle includes 19 detailed tutorials, with line-by-line commentary, putting the theory into practice.
The tutorials include:
Once you have mastered these tutorials, you will feel comfortable creating great apps that will work on any device in any language.
This eBook assumes that you have at least completed the “Hello world” tutorial which can be found on the official Android website. All the tutorials have been written with Eclipse (Helios) as the development environment. Naturally you can use any other development environment.
Available at Amazon.com
You can download the project files from the download page.