If Eclipse is not open, open it now and open the main.xml file in the layouts

162 Part II: Building and Publishing Your First Android Application values are stored — including the Chinese version of the strings.xml file. If Android cannot find such folder, the platform defaults to the default values folder, which contains the English version of the strings.xml file. For more on strings, see the section “Moving strings into resources,” earlier in this chapter. When it comes down to it, having a linguist update your strings and creating a new folder with the new strings.xml file located within are very simple things to do. Take this and expand it to other languages and devices and eventually Google TV . . . and you can see where I’m going. You’re no longer looking at mobile users as your target audience. You’re looking at Android users, and with the options coming out — this could be billions of users. Using resources correctly can make your expansion into foreign markets that much easier. Designing your application for various regions is a big topic. You can find more in-depth information in the Localization article of the SDK documentation here: http:developer.android.comguidetopicsresources localization.html. Although designing your application to be ready for various regions sounds compelling, it also helps to know that the Android Market allows you to spec- ify which region your device is targeted for. You’re not forced into releasing your application to all regions. Therefore, if you have written an application for the Berlin bus route system in Germany, it probably doesn’t make sense to have a Chinese version, unless you want to cater to Chinese tourists as well as German residents. I cover the Android Market in depth in Chapter 8. Chapter 7 Turning Your Application into a Home-Screen Widget In This Chapter ▶ Seeing how app widgets work in Android ▶ Understanding pending intents ▶ Building an App Widget Provider ▶ Putting your widget on the home screen U sability is the name of the game in regard to all disciples of application development. When it comes down to it, if your application is not usable, users will not use it. It’s that simple. You’ve built the Silent Mode Toggle application, and it works great and it’s very usable. Unfortunately, if this application were published to the Android Market, the application would not be very popular. Why? In short, the user is required to open the app and then click a button to silence the phone. If the user has not created a home-screen shortcut to the application, and the app is buried in the application launcher with thirty other applications, that means taking a few extra steps: unlocking the phone, opening the launcher, finding the appli- cation, opening the app, and then clicking the Silent button. At this point, the user might as well use the up and down volume keys found on most phones to silence the phone. Pressing the down volume key numerous times results in the phone eventually being set into silent mode. Therefore, the application’s usability is not very good. So how would you make this application more usable and feasible for the end user? Simple: Turn it into a home-screen widget. In this chapter, I demonstrate how to build a home-screen widget for your application. App widgets normally resemble small icons or very small views that exist on your home screen. This widget allows users to interact with your application by simply tapping an icon the home-screen widget. When you tap this icon, core functionality kicks in and toggles the silent mode for the user. In this chapter, you are introduced to the following classes: