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:
- View Animation Tutorial – this includes Frame animation where one image is swopped with another and Tweening, where for example some text fades in or out.
- Color State List tutorial – this tutorial shows how a color state list is used to change the color of an object when it’s state changes.
- Bitmap Tutorial –this tutorial shows how to use a bitmap both directly and via an alias.
- Nine-Patch Tutorial – this tutorial demonstrates how to use a nine-patch drawable in an application. It shows how to use it directly from the drawable folder as well as how to define a nine-patch drawable in a XML file.
- Layer List Tutorial – this tutorial demonstrates how to use a list of drawables saved in a XML file as a drawable object. When the app runs, the drawables in the list are displayed one above the other.
- State List Tutorial – this tutorial shows how to use a State List to change the background image of a button when the button is pressed, in focused or in default mode.
- Level List Tutorial - A level list is a drawable object that manages a number of alternative drawables. Each of these drawables is assigned a maximum level. We can then determine which drawable to use by usingsetLevel() in our code, passing it the appropriate level. The drawable with a level equal to or greater than this will be selected.
- Transition Drawable Tutorial – this tutorial demonstrates how to use a Transition Drawable. A TransitionDrawable is a drawable object that cross-fades between two drawable resources.
- Inset Drawable Tutorial – this demonstrates the Inset Drawable which we define in a XML file. We then reference it in the layout file to display a drawable in a view where the drawable is smaller than the view’s boundaries
- Clip Drawable Tutorial – this tutorial demonstrates how to use a Clip Drawable as a simple progress bar.
- Shape Drawable Tutorial – this tutorial shows how to create and use a Shape Drawable resource as a background image.
- Layout Tutorial – this tutorial briefly describes the use of layouts.
- Simple Resources Tutorial – this tutorial demonstrates how to combine a number of resources in one XML file. It covers the use of the following resources: Strings, String arrays, Plurals, Color, Dimensions, Integer arrays, Style, bool, integer and typed arrays.
- Scale Drawable Tutorial - this tutorial shows how to use the Scale Drawable resource to increase the size of a drawable.
- Options Menu Tutorial - this tutorial shows how to create a simple options menu.
- Assets and Raw Files Tutorial - this tutorial demonstrates how to use files in their raw form either from the assets folder or from the res>raw folder.
- XML File Tutorial - this tutorial shows how to use an XML resource file containing a number of records.
- Localization Tutorial - this tutorial shows how to accommodate three different languages in an app.
- Images, Rotation and Orientation Tutorial - This tutorial shows how one can allow for screen orientation changes and different size screens.
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.