The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.

Tutorial #4 - Adjusting Our Resources

Our EmPubLite project has some initial resources. However, the defaults are not what we want for the long term. So, in addition to adding new resources in future tutorials, we will fix the ones we already have in this tutorial.

This is a continuation of the work we did in the previous tutorial.

You can find the results of the previous tutorial and the results of this tutorial in the book’s GitHub repository.

Step #1: Changing the Name

Our application shows up everywhere as “EmPubLite”:

We should change that to be “EmPub Lite”, adding a space for easier reading, and to illustrate that this is a “lite” version of the full EmPub application.

Double-click on the res/values/strings.xml file in your project explorer.

In the XML editor for the string resources, you will find an element that looks like:

<string name="app_name">EmPubLite</string>

Change the text node in this element to EmPub Lite. Then save your changes, giving you something like:

  <string name="app_name">EmPub Lite</string>

Step #2: Changing the Icon

The build tools provide us with a stock icon to use for the launcher — the actual image used varies by Android tools release. However, we can change it to something else. For example, we could use the icon portion of the CommonsWare logo:

Figure 58: CommonsWare

Download the molecule PNG file from the CommonsWare Web site and save it somewhere on your development machine.

Then, right-click over the res/ directory in your main source set in the project explorer, and choose New > Image Asset from the context menu. That will bring up the Asset Studio wizard:

Asset Studio Wizard, First Page
Figure 59: Asset Studio Wizard, First Page

In the Icon Type drop-down, choose “Launcher Icons (Legacy only)”. This will change the wizard to look like:

Asset Studio Wizard, First Page, Legacy Mode
Figure 60: Asset Studio Wizard, First Page, Legacy Mode

Click the “Image” radio button in the “Asset Type” row. Then, click the “…” to the right of the “Path” field and choose the molecule.png file that you downloaded. Also, ensure that “Scaling” is set to “Shrink to Fit”, and choose “None” from the “Shape” drop-down. This should give you a preview of what the icons will look like:

Asset Studio Wizard, First Page, After Loading Image
Figure 61: Asset Studio Wizard, First Page, After Loading Image

Leave the rest of the wizard alone, then click Next to proceed to the next page:

Asset Studio Wizard, Second Page
Figure 62: Asset Studio Wizard, Second Page

You should get a warning towards the bottom, indicating that if you finish the wizard, you will overwrite existing files. This is expected, as we are trying to replace the old ic_launcher.png files with new ones. So, go ahead and click Finish.

Step #3: Running the Result

The preview of this section is in the process of being translated from its native Klingon.

In Our Next Episode…

The preview of this section is presently indisposed.