Testing Alternative Resources

It is important to test your app on different device configurations to see how your layouts and other resources look on those configurations. You can test on devices both real and virtual. You can also use the graphical layout tool.

The graphical layout tool has many options for previewing how a layout will appear in different configurations. You can preview the layout on different screen sizes, device types, API levels, languages, and more.

To see these options, open fragment_crime.xml in the graphical layout tool. Then try some of the settings in the toolbar shown in Figure 18.14.

Figure 18.14  Using graphical layout tool to preview various device configurations

Screenshot shows graphical layout tool with icons to preview the layout on different screen sizes, device types, API levels, languages.

You can ensure that you have included all of the necessary default resources by setting a device to a language that you have not localized any resources for. Run your app and put it through its paces. Visit all of the views and rotate them. If the app crashes, check Logcat for a Resource not found message to track down the missing default resource. Be on the lookout for non-crashing errors, such as the problem of resource IDs displaying instead of strings that we discussed earlier in this chapter.

Before continuing to the next chapter, you may want to change your device’s language back to English.

Congratulations! Now your CriminalIntent app can be enjoyed fully in both Spanish and English. Crimes will be logged. Cases will be solved. And all in the comfort of your user’s native language (so long as that is either Spanish or English). Adding support for more languages is simply a matter of adding additional qualified strings files.

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

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