Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 18. Localization > Localizing in Java code

18.5. Localizing in Java code

Many of the strings your application uses can be referenced in the application’s layout files, but there’s often a need for building a string dynamically at runtime to display to the user. These strings embedded into your code must be localized as well! In fact, our experience shows that it’s these strings that flesh out the application and test your discipline as a developer committed to localization. These are also the strings that send you back to the translation team with further requests for translation services!

The first and fundamental use of localized strings in code is the simple string retrieved from the string table and directly displayed without further formatting. We’ll start by looking at a snippet of the Field Service application’s code prior to localization. The following listing shows the onCreateOptionsMenu() method, which handles the creation of the presented menu options.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint